Skip to content

Commit f9bd4ff

Browse files
authored
fix: http request loading indicator (Kong#6265)
* flatten url bar * flattening continued * more flat * more more flat * fix lint * flatten network send into one call * unpack send everywhere * remove send with settgins * fix types * fix bug in download * contain interpolation and modal * abstract render try catch * send action * extract to file * remove plugin ignore code * remove unused * unpack misc functions * less misc functions * readd inso tests * split test runs * fix test * fix test * fix test * use workspace pathing * remove check-engine * add tech debt list
1 parent 94d035b commit f9bd4ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+622
-924
lines changed

.github/workflows/release-recurring.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ jobs:
5252
shell: bash
5353
run: NODE_OPTIONS='--max_old_space_size=6144' BUILD_TARGETS='${{ matrix.build-targets }}' npm run app-package
5454

55-
- name: Run critical test on packaged app
56-
run: npm run test:package --prefix packages/insomnia-smoke-test -- --project=Critical
55+
- name: Test critical path on packaged electron app
56+
run: npm run test:package -w packages/insomnia-smoke-test -- --project=Critical
5757

5858
- name: Upload smoke test traces
5959
uses: actions/upload-artifact@v3

.github/workflows/test.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,37 @@ jobs:
4343
- name: Type checks
4444
run: npm run type-check
4545

46-
- name: Run tests
47-
run: npm test
46+
- name: Test Insomnia
47+
run: npm test -w packages/insomnia
48+
49+
- name: Test Inso
50+
run: npm test -w packages/insomnia-inso
51+
52+
- name: Test Insomnia Testing
53+
run: npm test -w packages/insomnia-testing
54+
55+
- name: Test O2K
56+
run: npm test -w packages/openapi-2-kong
4857

4958
- name: Build app for smoke tests
5059
run: npm run app-build
5160

52-
- name: Run Smoke tests
61+
- name: Smoke test electron app
5362
# Partial Smoke test run, for regular CI triggers
5463
if: ${{ !startsWith(github.head_ref, 'release/') }}
55-
run: npm run test:build --prefix packages/insomnia-smoke-test -- --project=Smoke
64+
run: npm run test:build -w packages/insomnia-smoke-test -- --project=Smoke
5665

57-
- name: Run Prerelease tests
66+
- name: Prerelease test electron app
5867
# Full Smoke test run, for Release PRs
5968
if: ${{ startsWith(github.head_ref, 'release/') }}
60-
run: npm run test:build --prefix packages/insomnia-smoke-test -- --project=Default
69+
run: npm run test:build -w packages/insomnia-smoke-test -- --project=Default
6170

6271
- name: Set Inso CLI variables
6372
id: inso-variables
6473
shell: bash
6574
run: |
6675
INSO_VERSION="$(jq .version packages/insomnia-inso/package.json -rj)-run.${{ github.run_number }}"
6776
PKG_NAME="inso-ubuntu-latest-$INSO_VERSION"
68-
6977
echo "pkg-name=$PKG_NAME" >> $GITHUB_OUTPUT
7078
echo "inso-version=$INSO_VERSION" >> $GITHUB_OUTPUT
7179
@@ -74,7 +82,7 @@ jobs:
7482

7583
- name: Package Inso CLI binary
7684
run: |
77-
echo "Replacing electron binary with node binary"
85+
echo "Replacing node-libcurl electron binary with node binary"
7886
node_modules/.bin/node-pre-gyp install --update-binary --directory node_modules/@getinsomnia/node-libcurl
7987
npm run inso-package
8088
env:
@@ -92,7 +100,7 @@ jobs:
92100
name: ${{ steps.inso-variables.outputs.pkg-name }}
93101
path: packages/insomnia-inso/artifacts
94102

95-
- name: Run Inso CLI smoke tests
103+
- name: Smoke test Inso CLI
96104
run: npm run test:smoke:cli
97105

98106
- name: Upload smoke test traces

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ runtime = electron
22
target = 25.2.0
33
disturl = https://electronjs.org/headers
44
playwright_skip_browser_download=true
5+
engine-strict=true

DEVELOPMENT.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,26 @@ This is just a brief summary of Insomnia's current technical debt.
6969
- Loading large responses (~20 MB) can crash the app on weaker hardware.
7070
- Bundling `libcurl` (native module) has caused many weeks of headaches trying to get builds working across Windows, Mac, and Linux. More expertise here is definitely needed.
7171
- All input fields that support features like templating or code completion are actually [CodeMirror](https://codemirror.net/6/) instances. This isn't really debt, but may affect things going forward.
72-
- Use of `libcurl` means Insomnia can't run in a web browser and can't support bidirectional socket communication.
72+
73+
- [x] upgrade spectral e2e testing
74+
- [x] upgrading electron
75+
- [x] preload electron main functions
76+
- [x] update react classes to function components
77+
- [x] remove excess packages
78+
- [x] migrate redux to remix
79+
- [x] migrate lerna to npm workspaces
80+
- [x] CI slow ~30m (now 10m)
81+
- [x] styling vision (react-aria + tailwind)
82+
- [ ] de-polymorph database
83+
- [ ] codemirror is unmaintained
84+
- [ ] nedb is unmaintained
85+
- [ ] grpc state state should be in main rather than renderer
86+
- [ ] drag and drop is flakey
87+
- [ ] sync code is spaghetti
88+
- [ ] template rendering is spaghetti and has poor discoverability
89+
- [ ] inso abstraction limits networking improvements
90+
- [ ] testing feature doesn't scale with investment
91+
- [ ] unify curl.ts and libcurl-promise implementations
7392

7493
## Electron upgrade
7594

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"type-check": "npm run type-check --workspaces --if-present",
2929
"test": "npm run test --workspaces --if-present",
3030
"lint:markdown": "npx markdownlint-cli2 \"**/*.md\" \"#**/node_modules\"",
31-
"preinstall": "npx -y check-engine",
3231
"clean": "git clean -dfX",
3332
"inso-start": "npm start --workspace=packages/insomnia-inso",
3433
"inso-package": "npm run build:sr --workspace=packages/insomnia && npm run package --workspace=packages/insomnia-inso",

packages/insomnia-inso/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"scripts": {
2323
"lint": "eslint . --ext .js,.ts,.tsx --cache",
24-
"test": "echo 'fix these jest --runInBand'",
24+
"test": "esr esbuild.ts jest",
2525
"test:watch": "npm run test -- --watch",
2626
"test:snapshots": "npm run build && npm run test -- -u",
2727
"test:bundled-inso": "cross-env ./bin/inso run test \"Another suite\" -e \"OpenAPI env\" --src src/db/fixtures/nedb",

packages/insomnia-smoke-test/CLI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ From project root, in separate terminals:
3333

3434
```sh
3535
# start smoke test api
36-
npm run serve --prefix packages/insomnia-smoke-test
36+
npm run serve -w packages/insomnia-smoke-test
3737

3838
# build send-request
39-
npm run build:sr --prefix packages/insomnia
39+
npm run build:sr -w packages/insomnia
4040

4141
# watch inso
42-
npm run start --prefix packages/insomnia-inso
42+
npm run start -w packages/insomnia-inso
4343

4444
# run api test with dev bundle
4545
$PWD/packages/insomnia-inso/bin/inso run test "Echo Test Suite" --src $PWD/packages/insomnia-smoke-test/fixtures/inso-nedb --env Dev --verbose
@@ -49,7 +49,7 @@ $PWD/packages/insomnia-inso/bin/inso run test "Echo Test Suite" --src $PWD/packa
4949

5050
```sh
5151
# run modify package command and then a unit test
52-
npm run package --prefix packages/insomnia-inso && \
52+
npm run package -w packages/insomnia-inso && \
5353
$PWD/packages/insomnia-inso/binaries/inso run test "Echo Test Suite" --src $PWD/packages/insomnia-smoke-test/fixtures/inso-nedb --env Dev --verbose
5454

5555
```

packages/insomnia-smoke-test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ Each of the above commands will automatically run the Express server, so you do
126126
Non recurring / non-CI tests, like pre-release ones, can be run using [Playwright VS Code extension](#playwright-vs-code-extension) or by running `test:dev` against the desired test file:
127127

128128
```shell
129-
npm run test:dev --prefix packages/insomnia-smoke-test -- preferences-interactions
129+
npm run test:dev -w packages/insomnia-smoke-test -- preferences-interactions
130130
```

packages/insomnia/src/common/__tests__/misc.test.ts

Lines changed: 1 addition & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
22

33
import { globalBeforeEach } from '../../__jest__/before-each';
4+
import { chunkArray } from '../../sync/vcs/vcs';
45
import {
5-
capitalize,
6-
chunkArray,
7-
convertEpochToMilliseconds,
86
debounce,
9-
diffPatchObj,
107
filterHeaders,
118
fuzzyMatch,
129
fuzzyMatchAll,
1310
generateId,
1411
hasAuthHeader,
1512
isNotNullOrUndefined,
1613
keyedDebounce,
17-
pluralize,
18-
snapNumberToLimits,
1914
toKebabCase,
20-
toTitleCase,
21-
xmlDecode,
2215
} from '../misc';
2316

2417
describe('hasAuthHeader()', () => {
@@ -257,7 +250,6 @@ describe('fuzzyMatchAll()', () => {
257250
expect(fuzzyMatchAll('wrong this ou', ['testing', 'this', 'out'])).toEqual(null);
258251
});
259252
});
260-
261253
describe('chunkArray()', () => {
262254
it('works with exact divisor', () => {
263255
const chunks = chunkArray([1, 2, 3, 4, 5, 6], 3);
@@ -286,121 +278,6 @@ describe('chunkArray()', () => {
286278
});
287279
});
288280

289-
describe('pluralize()', () => {
290-
it('should not change pluralization', () => {
291-
expect(pluralize('Requests')).toBe('Requests');
292-
});
293-
294-
it('should end with s', () => {
295-
expect(pluralize('Request')).toBe('Requests');
296-
});
297-
298-
it('should end with ies', () => {
299-
expect(pluralize('Directory')).toBe('Directories');
300-
});
301-
});
302-
303-
describe('diffPatchObj()', () => {
304-
const a = {
305-
x: 1,
306-
};
307-
const b = {
308-
x: 2,
309-
y: 3,
310-
};
311-
const c = {
312-
x: 4,
313-
y: {
314-
z: 5,
315-
},
316-
};
317-
318-
it('does a basic merge', () => {
319-
expect(diffPatchObj(a, b)).toEqual({
320-
x: 2,
321-
y: 3,
322-
});
323-
expect(diffPatchObj(b, a)).toEqual({
324-
x: 1,
325-
y: 3,
326-
});
327-
});
328-
329-
it.skip('does a basic merge, deep', () => {
330-
expect(diffPatchObj(a, c, true)).toEqual({
331-
x: 2,
332-
y: 3,
333-
});
334-
expect(diffPatchObj(c, a, true)).toEqual({
335-
x: 1,
336-
});
337-
});
338-
339-
it.skip('does a basic nested merge', () => {
340-
expect(diffPatchObj(a, b)).toEqual({
341-
x: 2,
342-
y: 3,
343-
});
344-
expect(diffPatchObj(b, a)).toEqual({
345-
x: 1,
346-
y: {
347-
z: 5,
348-
},
349-
});
350-
});
351-
352-
it.skip('does a basic nested merge, deep', () => {
353-
expect(diffPatchObj(a, c, true)).toEqual({
354-
x: 2,
355-
y: 3,
356-
});
357-
expect(diffPatchObj(c, a, true)).toEqual({
358-
x: 1,
359-
y: {
360-
z: 5,
361-
},
362-
});
363-
});
364-
});
365-
366-
describe('convertEpochToMilliseconds()', () => {
367-
it('should convert microseconds to milliseconds', () => {
368-
expect(convertEpochToMilliseconds(1617616858412123)).toBe(1617616858412);
369-
});
370-
371-
it('should convert seconds to milliseconds', () => {
372-
expect(convertEpochToMilliseconds(1617617010)).toBe(1617617010000);
373-
});
374-
375-
it('should output same if value already in milliseconds', () => {
376-
expect(convertEpochToMilliseconds(1617617141412)).toBe(1617617141412);
377-
});
378-
});
379-
380-
describe('snapNumberToLimits()', () => {
381-
it('should return value', () => {
382-
expect(snapNumberToLimits(2)).toBe(2);
383-
expect(snapNumberToLimits(2, 0)).toBe(2);
384-
expect(snapNumberToLimits(2, 0, 3)).toBe(2);
385-
expect(snapNumberToLimits(2, 2, 2)).toBe(2);
386-
expect(snapNumberToLimits(2, null, null)).toBe(2);
387-
expect(snapNumberToLimits(2, NaN, NaN)).toBe(2);
388-
});
389-
390-
it('should snap to min', () => {
391-
expect(snapNumberToLimits(2, 3)).toBe(3);
392-
expect(snapNumberToLimits(2, 3, 5)).toBe(3);
393-
expect(snapNumberToLimits(2, 3, null)).toBe(3);
394-
expect(snapNumberToLimits(2, 3, NaN)).toBe(3);
395-
});
396-
397-
it('should snap to max', () => {
398-
expect(snapNumberToLimits(5, 0, 3)).toBe(3);
399-
expect(snapNumberToLimits(5, null, 3)).toBe(3);
400-
expect(snapNumberToLimits(5, NaN, 3)).toBe(3);
401-
});
402-
});
403-
404281
describe('isNotNullOrUndefined', () => {
405282
it('should return correctly', () => {
406283
expect(isNotNullOrUndefined(0)).toBe(true);
@@ -411,14 +288,6 @@ describe('isNotNullOrUndefined', () => {
411288
});
412289
});
413290

414-
describe('xmlDecode()', () => {
415-
it('unescape characters', () => {
416-
const input = '<a href="http://example.com?query1=value1&query2=value2">a link</a>';
417-
const output = '<a href="http://example.com?query1=value1&query2=value2">a link</a>';
418-
expect(xmlDecode(input)).toEqual(output);
419-
});
420-
});
421-
422291
describe('toKebabCase', () => {
423292
it('leaves strings without spaces alone', () => {
424293
expect(toKebabCase('')).toEqual('');
@@ -433,31 +302,3 @@ describe('toKebabCase', () => {
433302
expect(toKebabCase('a A b B c')).toEqual('a-A-b-B-c');
434303
});
435304
});
436-
437-
describe('capitalize', () => {
438-
it('capitalizes first letter', () => {
439-
expect(capitalize('')).toEqual('');
440-
expect(capitalize('a')).toEqual('A');
441-
expect(capitalize('A')).toEqual('A');
442-
expect(capitalize('abcd')).toEqual('Abcd');
443-
expect(capitalize('abcd efg')).toEqual('Abcd efg');
444-
});
445-
it('lowercases all other letters but the first', () => {
446-
expect(capitalize('aBcd efg')).toEqual('Abcd efg');
447-
expect(capitalize('aBcd Efg')).toEqual('Abcd efg');
448-
});
449-
});
450-
451-
describe('toTitleCase', () => {
452-
it('capitalizes first letter of each word', () => {
453-
expect(toTitleCase('')).toEqual('');
454-
expect(toTitleCase('a')).toEqual('A');
455-
expect(toTitleCase('A')).toEqual('A');
456-
expect(toTitleCase('abcd')).toEqual('Abcd');
457-
expect(toTitleCase('abcd efg')).toEqual('Abcd Efg');
458-
});
459-
it('lowercases all other letters but the first of each word', () => {
460-
expect(toTitleCase('aBcd efg')).toEqual('Abcd Efg');
461-
expect(toTitleCase('aBcd Efg')).toEqual('Abcd Efg');
462-
});
463-
});

0 commit comments

Comments
 (0)