34 Commits

Author SHA1 Message Date
Jack Kavanagh
79c544238b feat: disable nodeIntegration in renderer mainWindow, remove Node import check tooling (#9996)
* Add vault-crypto/mime utilities and remove heavyweight third-party imports

- Add AES-GCM vault-crypto utility with tests (replaces node-forge usage)
- Add common/mime.ts to replace mime-types package dependency
- Replace tough-cookie import in response-cookies-viewer with inline parser
- Replace @grpc/grpc-js status import in grpc-status-tag with inline constant
- Replace electron.ipcRenderer in auth.clear-vault-key with showToast()
- Remove unused analytics call from window-utils

* Fix impure Date.now() key on CodeEditor; use setValue via ref instead

Replace key={Date.now()} with a useEffect that calls editorRef.current.setValue(snippet)
whenever snippet changes, keeping the editor mounted. Also apply prettier fixes from quick-check.

* fix: address Copilot review comments on PR #9992

- vault-crypto: replace forge-in-renderer with IPC bridge (main process
  retains forge; renderer calls window.main.vault.{en,de}cryptSecretValue)
- mime.ts: expand lookup table to 48 entries (webp, wasm, mp4, docx, xlsx,
  fonts, audio/video, etc.) and fix remaining mime-types import in send route
- response-viewer: move charset alias map to module level; normalise iconv-lite
  alias names (utf8, latin1, win1252, …) to WHATWG labels for TextDecoder
- auth.clear-vault-key: fix typo "all you local" → "all your local"

* fix: sort imports in send route

* feat: disable nodeIntegration in renderer mainWindow, remove import check tooling

- Set nodeIntegration:false and contextIsolation:true on mainWindow webPreferences
  (hidden window keeps nodeIntegration:true for user script execution)
- Split script-security-rules.ts out of script-security-policy.ts so the renderer
  can import display-only constants without pulling in require-interceptor
- Add templating/renderer-safe.ts with Node-free render/reload/getTagDefinitions;
  update all renderer callers to import from it instead of templating/index
- Split insomnia-testing generate.ts: move generateToFile to generate-to-file.ts
  so generate() has no Node imports; expose generateToFile from new entry point
- Move runTests execution to main process via IPC (run-tests channel) so the
  renderer routes no longer import the Mocha-backed test runner directly
- Delete vite-plugin-electron-node-require.ts, check-renderer-node-imports.ts,
  renderer-node-import-baseline.json and all related scripts/plugins now that the
  renderer bundle is free of Node built-in imports

* fix: sort imports, use static TestResults type, remove unused analytics import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* remove mime stuff

* remove ci step

* update plan

* insomnia testing adapter

* use export method

* trick react router ssr

* add renderer errors

* globalThis

* improve error

* move plugin types

* ipc validate proto

* fix import

* plugin types

* polyfill events for jshint

* restore node require plugin

* vault adapter

* add crypto bridges

* tough-cookie ipc

* util stub

* split cookie into network adapter

* assert

* fix plugin index import

* serialise cookie

* decouple renderer from scripting

* Fix rebase conflicts and import path issues

- Fix incorrect ~/insomnia-data imports (should be insomnia-data package)
- Remove non-existent mime utility imports and provide simple fallback
- Remove incorrect analytics call from main process
- Remove unused imports (Settings, Cookie)
- Fix Response type annotation for getResponseBodyBuffer

* lint

* fix tests

* fix: use dynamic import for crypt in session.ts for main process compatibility

The session.ts module is used in both renderer and main process contexts (via sync.invoke IPC handlers). When running in the main process, window.main is undefined, causing TypeError when trying to access window.main.crypt.decryptAES().

Changes:
- Use dynamic import of crypt module (only loaded in main process context)
- In renderer: window.main.crypt is always available so dynamic import never executes
- In main process: dynamic import loads crypt with node:crypto support
- Protect loginStateChange() calls with window existence checks

This avoids bundling node:crypto in the Vite renderer build while still supporting both execution contexts.

Fixes E2E test failures in sync operations (remoteBackendProjects, _assertSession, etc.) caused by disabled nodeIntegration.

* fix: add aria-label to template tag preview and browser-safe encoding fallback

- Add aria-label="Live Preview" to textarea in TagEditor for better Playwright accessibility
- Add atob() fallback for decodeEncoding in browser contexts where Buffer isn't available
- Fixes smoke test element discovery for template tag preview modal

* fix: add explicit waits for element stability in environment test

Add toBeEnabled() and toBeVisible() waits before clicking elements in the
'kv pair environment can be updated' test. This prevents timeout errors from
unstable/flickering elements during modal interactions, especially in
high-concurrency shard execution.

* remove unused

* add autocomplete generate test step

* fix lint

* put analytics back in

* combine vault and crypto adapter

* remove unused export split

* remove insomnia-testing cruft, addressing feedback

* fix: use direct imports in insomnia-inso after insomnia-testing index.ts removal

* fix circular reference

* fix: move createElectronNotifier to main process to fix SSR error

Move the electron-dependent createElectronNotifier function from repo-file-watcher.ts
to git-service.ts to prevent electron imports from being evaluated in the renderer/SSR context.

* export har ipc bridge

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 13:40:44 +08:00
Bingbing
b09cde814d refactor: extract insomnia-data into workspace package (#10010)
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
2026-06-02 09:49:10 +00:00
Ryan Willis
52d64a0116 chore(deps): bump dependencies (#9756) 2026-04-03 19:08:00 -04:00
Jack Kavanagh
c62a114d28 Chore: eslint-autofixes (#9421)
* sort and remove a few

* autofix 1

* remove useless undefined

* fix types

* number seperators

* native coercion

* utf8

* explicit number

* dom node dataset

* explicit unused catch

* array find

* fix types

* prefer negative index

* from code point

* fix error layout

* prefer ternary

* explicit length

* useless case

* named functions

* utf8

* import style

* default parameters

* no instance of

* clone

* use regex test

* single call

* prettier

* fix types

* Revert "use regex test"

This reverts commit 8fb9e991fffa9e3a51ff75cdc29dad331ed2fb66.
2025-11-27 09:36:52 +00:00
James Gatz
3145b57aa8 feat(Tests): Add require interceptor in tests (#8758)
* block requiring arbitary modules in test scripts

* cleanup log

* fix require/chai issues

* update tests
2025-05-28 08:59:45 +00:00
Jack Kavanagh
5543a6e08f tooling: unicorn eslint (#8743)
* set a few unicorn rules

* autofixes

* fix types

* more minor fixes

* more autofixes

* more normalisation

* prettier run
2025-05-27 09:47:46 +00:00
Jack Kavanagh
b30978e33b Full-prettier-run (#8605)
* prettier

* remove markdown linting
2025-04-11 13:37:19 +02:00
Jack Kavanagh
4084bcded9 More-eslint-fixes (#8593)
* forced type import

* add linting to sdk

* insomnia testing
2025-04-08 17:28:59 +02:00
Jack Kavanagh
b429feb2f2 Eslint-v9 (#8578)
* autofix recommended

* first pass

* autofix

* fixed lint errors

* pin ts
2025-04-03 16:15:03 +00:00
Jack Kavanagh
ddb57dbcac Fix/more-lint-rules (#8572)
* wraapper types

* enable unsafe function rule

* autofix recommended

* enable latest eslint recommended

* fix lint errors

* switch cases

* fix linting issues

* more lint fixes outside insomnia package

* fix test
2025-04-03 15:00:50 +00:00
Jack Kavanagh
ed81844130 eslint: remove unused disabled rules (#8571)
* remove unused disabled rules

* bump plugins

* bump tslint and ignore new rules

* fix exception

* remove unused plugins

* remove config helpers

* remove unused dep
2025-04-02 16:18:21 +02:00
Jack Kavanagh
ecba036fe3 vitest (#7754)
* vitest
- testing package

* remove jest and tidy

* sdk tests pass

* remove tsconfig

* vitest insomnia-inso

* snapshots

* clean up

* remove skipped logs

---------

Co-authored-by: gatzjames <jamesgatzos@gmail.com>
2024-07-25 13:37:15 +01:00
Jack Kavanagh
570c1c0055 verbatim syntax (#7718) 2024-07-15 11:44:21 +02:00
Jack Kavanagh
d02a20438f feat: inso parent folder auth (#7676)
* add logic

* test folder inheritance

* use crypto guid
2024-07-09 21:41:39 +02:00
KobeNguyenT
1d9768909b feat(tests): support json schema validation (#6532)
* feat(tests): support json schema validation

* add json schema to cli test

---------

Co-authored-by: gatzjames <jamesgatzos@gmail.com>
2023-12-06 16:09:46 +00:00
Jack Kavanagh
383f8ca43c Fix/react-warnings (#6643)
* test id warning

* kvp warning

* smelly key hacks

* safe key settings

* big brain id duplication

* fix type

* migrate cookie id with the same method
2023-11-06 10:58:57 +01:00
Filipe Freire
9800ad5aee chore: use npm workspaces (herecles) (#6193)
* chore: use npm workspaces

* edit workspaces

* fix

* fix

* force workspace order

* fix lock?

* define max_old_space_size on CI

* rm unnecessary bootstrap

* fix

* cleanup package.json

* bump vite and re-add build to bootstrap

* define paths on tsconfig

* fix some things

* add mocha to vite config

* bump mocha

* remove tsconfigs and project refs

* cache npm install

* fixed types

* assing repo root

* merge lint configs

* fix clean

* fix tests

* setup node

* lockfile

* fix bump

* fix lint markdown

* temporary disable inso tests

* dont use rimraf

* simplify clean

* fix version

* lockfile

* inso build

* fix lint

* lock file

* remove cleans

* remove unused

* tslib hack

* redownload node-libcurl

* rm version from scripts

* fix extrainfo bug

* use npm version

---------

Co-authored-by: jackkav <jackkav@gmail.com>
2023-08-10 00:14:16 +02:00
Jack Kavanagh
8db34fd7ce Bump/security (#6139)
* xmldom and protobuf

* bumps

* lock files

* bumps

* remove mkdirp

* fix test

* fix test

* set yaml version

* github flake

* send request bumps

* remove fs-extra

* lockfiles

* update playwright

* fix plugin install

* remove console logs

* fix fetch

* suppress fetch errors

* add typings to insomnia fetch

* remove console logs
2023-07-12 12:14:18 +02:00
Jack Kavanagh
f8c8d93508 Bump/pre-update-modules (#6087)
* bump deps

* lockfiles

* revert oidc bump

* remove dep

* refresh lock files

* refresh insomnia app lock file

* fix test

* more lock files
2023-07-05 08:57:13 +00:00
Dimitri Mitropoulos
c6a17d8a3e chore: single letter variables (#4848) 2022-06-08 12:27:21 -04:00
Dimitri Mitropoulos
6e5476de70 chore(deps) updates (all but insomnia) to use @jest/globals (#4793) 2022-05-18 17:27:31 -04:00
Dimitri Mitropoulos
52393eccc0 chore(deps): upgrades jest to 28 (#4783) 2022-05-17 08:18:06 -04:00
Dimitri Mitropoulos
e7c7c7ebdf change mocha timeout to be 1 minute (#4046) 2021-09-29 12:35:00 +00:00
Opender Singh
7ffc391428 add eslint rules for semi colons (#3989)
* add rules for semi colons

* run lint fix

* remove invalid eslint disable
2021-09-01 10:50:26 -04:00
Opender Singh
39eb725a55 🧹 Remove axios, use generics for send-request in insomnia-testing (#3949) 2021-08-27 04:02:59 +00:00
Dimitri Mitropoulos
0178533e52 Feat/eslint import order (#3782) 2021-07-23 11:04:56 +12:00
Dimitri Mitropoulos
5f4c19da35 [TypeScript] Phase 1 & 2 (#3370)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-12 18:35:00 +12:00
Opender Singh
27f006bc46 Prompt for test suite from CLI (#2338)
* Add unit tests to git-repo fixture

* Add to nedb fixture

* Can read suites and tests from git repo and nedb

* Prompt for test suite

* Prompt for env

* sub envs

* Add noenv to env prompt

* Add --ci flag to disable prompts

* Hook up --keep-file

* WIP

* WIP

* WIP

* Update

* Fix unit tests

* Update webpack config

* Fix

* fix

* Package lock

* Disable console.log when running unit tests

* no-log wrap

* Console log test

* Console log test

* Tests

* Add tests for cli

* Update

* WIP

* More tests

* fix

* Prompt test suite tests

* env prompt tests

* Update

* Update

* Extract workspace model

* Extract apiSpec model

* Extract unitTestSuite model

* Extract environment model

* Move types and prompts

* Rename
2020-07-08 08:17:02 +12:00
Gregory Schier
eae0d8d433 Unit test improvements (#2337)
* Start working on insomnia-testing package to generate Mocha code

* Moved some things around

* Integration tests and ability to run multiple files

* Fix integration tests

* Rename runSuite to runMochaTests

* Add types for test results

* Fix lint errors

* Play with Chia assertions

* insomnia and chai globals, plus a bunch of improvements

* Stub chai and axios Flow types

* Ability to reference requests by ID

* Fix chai flow-typed location

* Address PR comments (small tweaks)

* Basic UI going

* Lots and lots and lots

* Pretty-much done with the unit test UI

* Minor CSS tweak

* Activity bar triple toggle and more

* Minor tweak

* Unit Test and Suite deletion

* Bump Designer version

* Fix eslint stuff

* Fix insomnia-testing tests

* Fix tests

* lib@2.2.9

* Remove tests tab from response pane

* Hook up Insomnia networking

* Fix linting

* Bump version for alpha

* Remove extra ActivityToggleSwitch

* Remove unused import

* Add test:pre-release script that excludes CLI tests

* Less repetition

* Clean some things up

* Tweaks after self-cr

* Undo request ID tag

* Swap out switch for new activity toggle component

* Extra check

* Remove dead code

* Delete dead test

* Oops, revert example code

* PR feedback

* Unit test UI tweaks

* More PR comment addresses

* Change test name
2020-07-01 15:57:42 -07:00
Gregory Schier
3883dc6feb POC for Unit Test UI (#2315)
* Start working on insomnia-testing package to generate Mocha code

* Moved some things around

* Integration tests and ability to run multiple files

* Fix integration tests

* Rename runSuite to runMochaTests

* Add types for test results

* Fix lint errors

* Play with Chia assertions

* insomnia and chai globals, plus a bunch of improvements

* Stub chai and axios Flow types

* Ability to reference requests by ID

* Fix chai flow-typed location

* Address PR comments (small tweaks)

* Basic UI going

* Lots and lots and lots

* Pretty-much done with the unit test UI

* Minor CSS tweak

* Activity bar triple toggle and more

* Minor tweak

* Unit Test and Suite deletion

* Bump Designer version

* Fix eslint stuff

* Fix insomnia-testing tests

* Fix tests

* lib@2.2.9

* Remove tests tab from response pane

* Hook up Insomnia networking

* Fix linting

* Bump version for alpha

* Remove extra ActivityToggleSwitch

* Remove unused import

* Add test:pre-release script that excludes CLI tests

* Less repetition

* Clean some things up

* Tweaks after self-cr

* Undo request ID tag

* Swap out switch for new activity toggle component

* Extra check

* Remove dead code

* Delete dead test

* Oops, revert example code

* PR feedback

* More PR comment addresses
2020-07-01 14:17:14 -07:00
Gregory Schier
45861b6393 POC to get Insomnia networking available outside of app (#2329)
* Hacked insomnia lib package to get Insomnia's networking in tests

* Some small tweaks

* Got it mostly working

* Tweak

* Fix

* Fix pkg

* Fix some things

* Add comment

* Comment out log

* Some tweaks after doing a self code review

* Fix test

* Update app name for `insomnia-send-request`

* Update package-lock

* Update package-locks

* Fix tests

* Add gitignore

* Fix tests hopefully

* Fix accidental dep deletions

* Fix tests again

* Mock for all tests

* Update tests again

* Don't compile for Electron for tests

* Update release scripts to disable tests
2020-06-30 12:36:15 -07:00
Opender Singh
85860ce031 Add unit testing to CLI, configurable Mocha reporter (#2311) 2020-06-30 09:54:12 +12:00
Gregory Schier
c0931d94b7 Update test fixtures and support sendRequest() callback (#2325)
* Update test fixtures and allow sendRequest() callback for testing

* Change runTests() to take in test src instead of a file

* Fix looping

* Fix tests and write temp test files into folder

* Fix Flow type for mocha
2020-06-29 10:40:15 -07:00
Gregory Schier
5220d34a3a Unit Test Generation and Running PoC (#2232)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2020-06-18 12:21:52 +12:00