Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@globocom/backstage-functions-sandbox

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@globocom/backstage-functions-sandbox - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

4

lib/Sandbox.js

@@ -190,6 +190,6 @@ const vm = require('vm');

runLocalCode(filename, req) {
runLocalCode(filename, req, { console } = {}) {
return new Promise((accept, reject) => {
const code = fs.readFileSync(filename, 'utf8');
const options = { prefix: filename };
const options = { prefix: filename, console };
const invalid = this.testSyntaxError(filename, code, options);

@@ -196,0 +196,0 @@

{
"name": "@globocom/backstage-functions-sandbox",
"version": "0.5.0",
"version": "0.5.1",
"description": "Sandbox for Backstage functions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -385,3 +385,36 @@ const expect = require('chai').expect;

});
describe('options', () => {
it('should allow pass a console instance', (done) => {
const filename = './test/support/valid.js';
const req = {};
const mockedConsole = {
error: () => {},
log: () => {},
info: () => {},
warn: () => {},
};
const testSyntaxErrorCalls = [];
testSandbox.testSyntaxError = (...args) => {
testSyntaxErrorCalls.push(args);
};
const runScriptCalls = [];
testSandbox.runScript = (...args) => {
runScriptCalls.push(args);
return Promise.resolve();
};
testSandbox
.runLocalCode(filename, req, { console: mockedConsole })
.then(() => {
expect(testSyntaxErrorCalls[0][2].console).to.eql(mockedConsole);
expect(runScriptCalls[0][2].console).to.eql(mockedConsole);
done();
}).catch(err => done(err));
});
});
});
});
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