Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/postmanlabs/postman-sandbox
Sandbox for Postman Scripts to run in Node.js or browser
https://github.com/postmanlabs/postman-sandbox
contextify postman sandbox vm
Last synced: about 1 month ago
JSON representation
Sandbox for Postman Scripts to run in Node.js or browser
- Host: GitHub
- URL: https://github.com/postmanlabs/postman-sandbox
- Owner: postmanlabs
- License: apache-2.0
- Created: 2016-11-30T08:19:26.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2024-06-12T12:22:52.000Z (5 months ago)
- Last Synced: 2024-06-13T11:27:06.306Z (5 months ago)
- Topics: contextify, postman, sandbox, vm
- Language: JavaScript
- Homepage:
- Size: 6.72 MB
- Stars: 102
- Watchers: 18
- Forks: 57
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.yaml
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Postman Sandbox [![Build Status](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml/badge.svg)](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/postmanlabs/postman-sandbox/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/postman-sandbox)
Module that unifies execution of third-party JavaScript within Node.js and Browser.
> This module is part of Postman Runtime Core and is not intended for independent use.
>
> If you are looking to execute collections, you should bee using [Newman](https://github.com/postmanlabs/newman)## Usage
```js
var Sandbox = require('postman-sandbox'),
context;Sandbox.createContext(function (err, ctx) {
if (err) {
return console.error(err);
}ctx.execute(`// code here`, {}, {}, function (err) {
if (err) {
return console.error(err);
}
console.log('executed')
});
});
```## Sandbox Environment
The following section outlines the API available inside sandbox scripts
### pm
- pm.test
- pm.info
- pm.vault
- pm.globals
- pm.cookies
- pm.execution
- pm.variables
- pm.visualizer
- pm.sendRequest
- pm.environment
- pm.iterationData
- pm.collectionVariables#### pre-request script specials
- pm.request
#### test script specials
- pm.request
- pm.response## Events fired from Sandbox
- pong
- error
- console
- execution
- execution.error
- execution.error.*
- execution.request.*
- execution.result.*
- execution.cookies.*
- execution.skipRequest.*## Events responded to
- ping
- execute
- execution.abort.*
- execution.response.*
- execution.cookies.*## Contributing
### Debug in browser
To debug tests in Chrome's DevTools, start tests using `npm run test-browser -- --debug` and click `DEBUG`.