Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release-recurring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
shell: bash
run: NODE_OPTIONS='--max_old_space_size=6144' BUILD_TARGETS='${{ matrix.build-targets }}' npm run app-package

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

- name: Upload smoke test traces
uses: actions/upload-artifact@v3
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,37 @@ jobs:
- name: Type checks
run: npm run type-check

- name: Run tests
run: npm test
- name: Test Insomnia
run: npm test -w packages/insomnia

- name: Test Inso
run: npm test -w packages/insomnia-inso

- name: Test Insomnia Testing
run: npm test -w packages/insomnia-testing

- name: Test O2K
run: npm test -w packages/openapi-2-kong

- name: Build app for smoke tests
run: npm run app-build

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

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

- name: Set Inso CLI variables
id: inso-variables
shell: bash
run: |
INSO_VERSION="$(jq .version packages/insomnia-inso/package.json -rj)-run.${{ github.run_number }}"
PKG_NAME="inso-ubuntu-latest-$INSO_VERSION"

echo "pkg-name=$PKG_NAME" >> $GITHUB_OUTPUT
echo "inso-version=$INSO_VERSION" >> $GITHUB_OUTPUT

Expand All @@ -74,7 +82,7 @@ jobs:

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

- name: Run Inso CLI smoke tests
- name: Smoke test Inso CLI
run: npm run test:smoke:cli

- name: Upload smoke test traces
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ runtime = electron
target = 25.2.0
disturl = https://electronjs.org/headers
playwright_skip_browser_download=true
engine-strict=true
21 changes: 20 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,26 @@ This is just a brief summary of Insomnia's current technical debt.
- Loading large responses (~20 MB) can crash the app on weaker hardware.
- 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.
- 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.
- Use of `libcurl` means Insomnia can't run in a web browser and can't support bidirectional socket communication.

- [x] upgrade spectral e2e testing
- [x] upgrading electron
- [x] preload electron main functions
- [x] update react classes to function components
- [x] remove excess packages
- [x] migrate redux to remix
- [x] migrate lerna to npm workspaces
- [x] CI slow ~30m (now 10m)
- [x] styling vision (react-aria + tailwind)
- [ ] de-polymorph database
- [ ] codemirror is unmaintained
- [ ] nedb is unmaintained
- [ ] grpc state state should be in main rather than renderer
- [ ] drag and drop is flakey
- [ ] sync code is spaghetti
- [ ] template rendering is spaghetti and has poor discoverability
- [ ] inso abstraction limits networking improvements
- [ ] testing feature doesn't scale with investment
- [ ] unify curl.ts and libcurl-promise implementations

## Electron upgrade

Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"type-check": "npm run type-check --workspaces --if-present",
"test": "npm run test --workspaces --if-present",
"lint:markdown": "npx markdownlint-cli2 \"**/*.md\" \"#**/node_modules\"",
"preinstall": "npx -y check-engine",
"clean": "git clean -dfX",
"inso-start": "npm start --workspace=packages/insomnia-inso",
"inso-package": "npm run build:sr --workspace=packages/insomnia && npm run package --workspace=packages/insomnia-inso",
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia-inso/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"scripts": {
"lint": "eslint . --ext .js,.ts,.tsx --cache",
"test": "echo 'fix these jest --runInBand'",
"test": "esr esbuild.ts jest",
"test:watch": "npm run test -- --watch",
"test:snapshots": "npm run build && npm run test -- -u",
"test:bundled-inso": "cross-env ./bin/inso run test \"Another suite\" -e \"OpenAPI env\" --src src/db/fixtures/nedb",
Expand Down
8 changes: 4 additions & 4 deletions packages/insomnia-smoke-test/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ From project root, in separate terminals:

```sh
# start smoke test api
npm run serve --prefix packages/insomnia-smoke-test
npm run serve -w packages/insomnia-smoke-test

# build send-request
npm run build:sr --prefix packages/insomnia
npm run build:sr -w packages/insomnia

# watch inso
npm run start --prefix packages/insomnia-inso
npm run start -w packages/insomnia-inso

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

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

```
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia-smoke-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ Each of the above commands will automatically run the Express server, so you do
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:

```shell
npm run test:dev --prefix packages/insomnia-smoke-test -- preferences-interactions
npm run test:dev -w packages/insomnia-smoke-test -- preferences-interactions
```
161 changes: 1 addition & 160 deletions packages/insomnia/src/common/__tests__/misc.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';

import { globalBeforeEach } from '../../__jest__/before-each';
import { chunkArray } from '../../sync/vcs/vcs';
import {
capitalize,
chunkArray,
convertEpochToMilliseconds,
debounce,
diffPatchObj,
filterHeaders,
fuzzyMatch,
fuzzyMatchAll,
generateId,
hasAuthHeader,
isNotNullOrUndefined,
keyedDebounce,
pluralize,
snapNumberToLimits,
toKebabCase,
toTitleCase,
xmlDecode,
} from '../misc';

describe('hasAuthHeader()', () => {
Expand Down Expand Up @@ -257,7 +250,6 @@ describe('fuzzyMatchAll()', () => {
expect(fuzzyMatchAll('wrong this ou', ['testing', 'this', 'out'])).toEqual(null);
});
});

describe('chunkArray()', () => {
it('works with exact divisor', () => {
const chunks = chunkArray([1, 2, 3, 4, 5, 6], 3);
Expand Down Expand Up @@ -286,121 +278,6 @@ describe('chunkArray()', () => {
});
});

describe('pluralize()', () => {
it('should not change pluralization', () => {
expect(pluralize('Requests')).toBe('Requests');
});

it('should end with s', () => {
expect(pluralize('Request')).toBe('Requests');
});

it('should end with ies', () => {
expect(pluralize('Directory')).toBe('Directories');
});
});

describe('diffPatchObj()', () => {
const a = {
x: 1,
};
const b = {
x: 2,
y: 3,
};
const c = {
x: 4,
y: {
z: 5,
},
};

it('does a basic merge', () => {
expect(diffPatchObj(a, b)).toEqual({
x: 2,
y: 3,
});
expect(diffPatchObj(b, a)).toEqual({
x: 1,
y: 3,
});
});

it.skip('does a basic merge, deep', () => {
expect(diffPatchObj(a, c, true)).toEqual({
x: 2,
y: 3,
});
expect(diffPatchObj(c, a, true)).toEqual({
x: 1,
});
});

it.skip('does a basic nested merge', () => {
expect(diffPatchObj(a, b)).toEqual({
x: 2,
y: 3,
});
expect(diffPatchObj(b, a)).toEqual({
x: 1,
y: {
z: 5,
},
});
});

it.skip('does a basic nested merge, deep', () => {
expect(diffPatchObj(a, c, true)).toEqual({
x: 2,
y: 3,
});
expect(diffPatchObj(c, a, true)).toEqual({
x: 1,
y: {
z: 5,
},
});
});
});

describe('convertEpochToMilliseconds()', () => {
it('should convert microseconds to milliseconds', () => {
expect(convertEpochToMilliseconds(1617616858412123)).toBe(1617616858412);
});

it('should convert seconds to milliseconds', () => {
expect(convertEpochToMilliseconds(1617617010)).toBe(1617617010000);
});

it('should output same if value already in milliseconds', () => {
expect(convertEpochToMilliseconds(1617617141412)).toBe(1617617141412);
});
});

describe('snapNumberToLimits()', () => {
it('should return value', () => {
expect(snapNumberToLimits(2)).toBe(2);
expect(snapNumberToLimits(2, 0)).toBe(2);
expect(snapNumberToLimits(2, 0, 3)).toBe(2);
expect(snapNumberToLimits(2, 2, 2)).toBe(2);
expect(snapNumberToLimits(2, null, null)).toBe(2);
expect(snapNumberToLimits(2, NaN, NaN)).toBe(2);
});

it('should snap to min', () => {
expect(snapNumberToLimits(2, 3)).toBe(3);
expect(snapNumberToLimits(2, 3, 5)).toBe(3);
expect(snapNumberToLimits(2, 3, null)).toBe(3);
expect(snapNumberToLimits(2, 3, NaN)).toBe(3);
});

it('should snap to max', () => {
expect(snapNumberToLimits(5, 0, 3)).toBe(3);
expect(snapNumberToLimits(5, null, 3)).toBe(3);
expect(snapNumberToLimits(5, NaN, 3)).toBe(3);
});
});

describe('isNotNullOrUndefined', () => {
it('should return correctly', () => {
expect(isNotNullOrUndefined(0)).toBe(true);
Expand All @@ -411,14 +288,6 @@ describe('isNotNullOrUndefined', () => {
});
});

describe('xmlDecode()', () => {
it('unescape characters', () => {
const input = '<a href="http://example.com?query1=value1&query2=value2">a link</a>';
const output = '<a href="http://example.com?query1=value1&query2=value2">a link</a>';
expect(xmlDecode(input)).toEqual(output);
});
});

describe('toKebabCase', () => {
it('leaves strings without spaces alone', () => {
expect(toKebabCase('')).toEqual('');
Expand All @@ -433,31 +302,3 @@ describe('toKebabCase', () => {
expect(toKebabCase('a A b B c')).toEqual('a-A-b-B-c');
});
});

describe('capitalize', () => {
it('capitalizes first letter', () => {
expect(capitalize('')).toEqual('');
expect(capitalize('a')).toEqual('A');
expect(capitalize('A')).toEqual('A');
expect(capitalize('abcd')).toEqual('Abcd');
expect(capitalize('abcd efg')).toEqual('Abcd efg');
});
it('lowercases all other letters but the first', () => {
expect(capitalize('aBcd efg')).toEqual('Abcd efg');
expect(capitalize('aBcd Efg')).toEqual('Abcd efg');
});
});

describe('toTitleCase', () => {
it('capitalizes first letter of each word', () => {
expect(toTitleCase('')).toEqual('');
expect(toTitleCase('a')).toEqual('A');
expect(toTitleCase('A')).toEqual('A');
expect(toTitleCase('abcd')).toEqual('Abcd');
expect(toTitleCase('abcd efg')).toEqual('Abcd Efg');
});
it('lowercases all other letters but the first of each word', () => {
expect(toTitleCase('aBcd efg')).toEqual('Abcd Efg');
expect(toTitleCase('aBcd Efg')).toEqual('Abcd Efg');
});
});
Loading