api-client/packages/hoppscotch-js-sandbox
jamesgeorge007 98f07f8a4c test(js-sandbox): expand unsupported API coverage and sync error messages
Add comprehensive test coverage for unsupported Postman APIs and ensure
consistent error messages across pre-request and post-request contexts.

Test improvements:
- Expand coverage from 13 to 25 unsupported APIs (50 tests total)
- Add missing APIs: collectionVariables.set/unset/has/clear/toObject,
  vault.set/unset, iterationData.set/unset/has/toJSON
- Fix assertions to match actual error format with prefix
- Add pre-request context test for pm.execution.location

Implementation fixes:
- Add missing pm.iterationData.toJSON() in pre-request.js
- Sync post-request.js collectionVariables error messages to match
  pre-request.js ("use environment or request variables instead")
2025-11-12 14:35:16 +05:30
..
src test(js-sandbox): expand unsupported API coverage and sync error messages 2025-11-12 14:35:16 +05:30
.eslintrc.cjs chore: bump dependencies (#4444) 2024-10-24 03:25:55 +05:30
.gitignore refactor: bring js-sandbox project to the monorepo 2021-09-25 01:01:22 +05:30
.prettierignore refactor: bring js-sandbox project to the monorepo 2021-09-25 01:01:22 +05:30
.prettierrc.cjs chore: lint + bump deps 2021-11-04 18:23:50 +05:30
index.d.ts refactor(scripting-revamp): migrate js-sandbox to web worker/Node vm based implementation (#3619) 2023-12-07 16:10:42 +05:30
node.d.ts chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973) 2024-04-19 21:08:46 +05:30
package.json feat(scripting-revamp): chai powered assertions and postman compatibility layer (#5417) 2025-10-27 17:49:58 +05:30
README.md refactor: check spelling (#2200) 2022-03-25 16:49:28 +05:30
setupFiles.ts chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973) 2024-04-19 21:08:46 +05:30
tsconfig.json refactor(scripting-revamp): migrate js-sandbox to web worker/Node vm based implementation (#3619) 2023-12-07 16:10:42 +05:30
vite.config.ts chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973) 2024-04-19 21:08:46 +05:30
web.d.ts chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973) 2024-04-19 21:08:46 +05:30

Hoppscotch JavaScript Sandbox ALPHA

This package deals with providing a JavaScript sandbox for executing various security sensitive external scripts.

How does this work?

This package makes use of quickjs-emscripten for building sandboxes for running external code on Hoppscotch.

Currently implemented sandboxes:

  • Hoppscotch Test Scripts
  • Hoppscotch Pre Request Scripts

Development

  1. Clone the repository
git clone https://github.com/hoppscotch/hoppscotch
  1. Install the package dependencies
pnpm install
  1. Navigate to the package folder
cd hoppscotch/packages/hoppscotch-js-sandbox
  1. Try out the demo src/demo.ts using:
npm run demo

Versioning

This project follows Semantic Versioning but as the project is still pre-1.0. The code and the public exposed API should not be considered to be fixed and stable. Things can change at any time!

License

This project is licensed under the MIT License - see LICENSE for more details.



built with ❤︎ by the Hoppscotch Team and contributors.