Skip to content

Sandbox for Postman Scripts to run in NodeJS or Chrome

License

Notifications You must be signed in to change notification settings

pankajk07/postman-sandbox

This branch is 371 commits behind postmanlabs/postman-sandbox:develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ed7c446 · Aug 17, 2020
Feb 22, 2017
Aug 14, 2020
Aug 17, 2020
Jun 23, 2020
Aug 17, 2020
Nov 30, 2016
Nov 30, 2016
Apr 20, 2019
Nov 1, 2018
Oct 25, 2017
Aug 5, 2020
Aug 5, 2020
Nov 30, 2016
Oct 25, 2017
Jun 4, 2020
Jul 13, 2020
Nov 30, 2016
Jun 23, 2020
Dec 13, 2019
Nov 30, 2016
Aug 14, 2020
Aug 14, 2020

Repository files navigation

Postman Sandbox Build Status codecov

Module that unifies execution of third-party JavaScript within Node VM and Browser iFrame.

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

Usage

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.globals
  • pm.environment
  • pm.collectionVariables
  • pm.test

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.*

Events responded to

  • ping
  • execute
  • execution.abort.*
  • execution.response.*
  • execution.cookies.*
  • execution.console.*

Contributing

Debug in browser

To debug tests in Chrome's DevTools, start tests using npm run test-browser -- --debug and click DEBUG.

About

Sandbox for Postman Scripts to run in NodeJS or Chrome

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%