New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

postman-sandbox

Package Overview
Dependencies
Maintainers
5
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-sandbox - npm Package Compare versions

Comparing version 3.5.5 to 3.5.6

40

lib/sandbox/timers.js

@@ -49,16 +49,38 @@ /**

* @extends Timers
*
* @note This is a very important piece of code from compatibility standpoint.
* The global timers need to be returned as a function that does not hold reference to the scope
* and does not retain references to scope. Aditionally, the invocation of the timer function is
* done without changing the scope to avoid Illegal Invocation errors.
*
* `timerFunctionNames` returns the suffixes of all timer operations that needs a
* a setter and clear method.
*/
defaultTimers = timerFunctionNames.reduce(function (timers, name) {
// get hold of default timer functions as available in global scope
var fnset = (new Function('return (typeof set' + name + // eslint-disable-line no-new-func
' === "function" ? set' + name + ' : undefined);'))(),
fnclr = (new Function('return (typeof clear' + name + // eslint-disable-line no-new-func
' === "function" ? clear' + name + ' : undefined);'))();
var
if (typeof fnset === FUNCTION) {
timers[('set' + name)] = fnset;
/**
* Check if global setter function is available
* @private
* @type {Boolean}
*/
// eslint-disable-next-line no-new-func
isGlobalSetterAvailable = (new Function(`return typeof set${name} === 'function'`))(),
/**
* Check if global clear function is available
* @private
* @type {Boolean}
*/
// eslint-disable-next-line no-new-func
isGlobalClearAvailable = (new Function(`return typeof clear${name} === 'function'`))();
if (isGlobalSetterAvailable) {
// eslint-disable-next-line no-new-func
timers[('set' + name)] = (new Function(`return function (fn, ms) { return set${name}(fn, ms); }`))();
}
if (typeof fnclr === FUNCTION) {
timers[('clear' + name)] = fnclr;
if (isGlobalClearAvailable) {
// eslint-disable-next-line no-new-func
timers[('clear' + name)] = (new Function(`return function (id) { return clear${name}(id); }`))();
}

@@ -65,0 +87,0 @@

{
"name": "postman-sandbox",
"version": "3.5.5",
"version": "3.5.6",
"description": "Sandbox for Postman Scripts to run in NodeJS or Chrome",

@@ -73,3 +73,3 @@ "main": "index.js",

"mocha": "5.0.1",
"moment": "2.26.0",
"moment": "2.27.0",
"packity": "0.3.2",

@@ -76,0 +76,0 @@ "parse-gitignore": "1.0.1",

@@ -66,1 +66,7 @@ # Postman Sandbox [![Build Status](https://travis-ci.org/postmanlabs/postman-sandbox.svg?branch=develop)](https://travis-ci.org/postmanlabs/postman-sandbox) [![codecov](https://codecov.io/gh/postmanlabs/postman-sandbox/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/postman-sandbox)

- execution.console.*
## Contributing
### Debug in browser
To debug tests in Chrome's DevTools, start tests using `npm run test-browser -- --debug` and click `DEBUG`.

@@ -87,3 +87,9 @@ // Karma configuration

// Use `npm run test-browser -- --debug` to debug tests in Chrome console
if (process.argv[2] === '--debug') {
configuration.browsers = ['Chrome'];
configuration.singleRun = false;
}
config.set(configuration);
};

@@ -99,3 +99,3 @@ describe('sandbox test assertion', function () {

(typeof window === 'undefined' ? it : it.skip)('should call the assertion event on async test', function (done) {
it('should call the assertion event on async test', function (done) {
Sandbox.createContext({debug: true}, function (err, ctx) {

@@ -135,3 +135,3 @@ if (err) { return done(err); }

(typeof window === 'undefined' ? it : it.skip)('should not wait if async done is not called', function (done) {
it('should not wait if async done is not called', function (done) {
Sandbox.createContext({debug: true}, function (err, ctx) {

@@ -162,3 +162,3 @@ if (err) { return done(err); }

(typeof window === 'undefined' ? it : it.skip)('should terminate script ' +
it('should terminate script ' +
'if async done is not called in an async script', function (done) {

@@ -192,3 +192,3 @@ Sandbox.createContext({debug: true}, function (err, ctx) {

(typeof window === 'undefined' ? it : it.skip)('should forward errors from asynchronous callback', function (done) {
it('should forward errors from asynchronous callback', function (done) {
Sandbox.createContext({debug: true}, function (err, ctx) {

@@ -232,3 +232,3 @@ if (err) { return done(err); }

(typeof window === 'undefined' ? it : it.skip)('should forward synchronous' +
it('should forward synchronous' +
'errors from asynchronous tests', function (done) {

@@ -235,0 +235,0 @@ Sandbox.createContext({debug: true}, function (err, ctx) {

@@ -73,3 +73,3 @@ describe('sandbox library - AJV', function () {

(typeof window === 'undefined' ? it : it.skip)('compileAsync', function (done) {
it('compileAsync', function (done) {
context.execute(`

@@ -76,0 +76,0 @@ var Ajv = require('ajv'),

@@ -0,1 +1,3 @@

// @todo find ways to support basic timeout, if not the real ones that protect
// against infinite loops, but at least ones that can emulate the timeout APIs
(typeof window === 'undefined' ? describe : describe.skip)('sandbox timeout', function () {

@@ -2,0 +4,0 @@ this.timeout(1000 * 60);

@@ -1,2 +0,2 @@

(typeof window === 'undefined' ? describe : describe.skip)('timers inside sandbox', function () {
describe('timers inside sandbox', function () {
this.timeout(1000 * 60);

@@ -3,0 +3,0 @@ var Sandbox = require('../../lib'),

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc