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

async-eval

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-eval - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

lib/wrap-error.js

4

lib/async-eval.js

@@ -5,3 +5,4 @@ var vm = require('vm');

var wrapAsyncFunctions = require('./wrap-async-functions')
var wrapAsyncFunctions = require('./wrap-async-functions');
var wrapError = require('./wrap-error');

@@ -52,2 +53,3 @@ module.exports = function asyncEval(code, options, callback) {

} catch (err) {
err = wrapError(err);
sandbox._error = err;

@@ -54,0 +56,0 @@ done(err);

var _ = require('underscore')._;
var wrapError = require('./wrap-error');

@@ -21,2 +22,3 @@ function wrapAsyncFunctions(asyncFunctions, sandbox, events, done, sandboxRoot) {

} catch (err) {
err = wrapError(err);
sandbox._error = err;

@@ -23,0 +25,0 @@ done(err);

@@ -5,3 +5,3 @@ {

"description": "Execute arbitrary JS with callbacks",
"version": "0.1.2",
"version": "0.1.3",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -59,2 +59,11 @@ var asyncEval = require('../');

it('should return a valid runtime error', function(done) {
asyncEval("var x = undefined; \n x.toString();", function(err) {
expect(err).to.exist;
expect(err instanceof TypeError).to.equal(true);
expect(err.message).to.equal("Cannot call method 'toString' of undefined");
done();
});
});
it('should not continue the event after cancel is called', function(done) {

@@ -101,2 +110,19 @@ var test = function() {

it('should return a valid runtime error from a callback', function(done) {
var test = function() {
var foo = undefined;
wait(function() {
foo.toString();
});
};
asyncEval(funcToString(test), {asyncFunctions: {wait: wait}}, function(err) {
expect(err).to.exist;
expect(err instanceof TypeError).to.equal(true);
expect(err.message).to.equal("Cannot call method 'toString' of undefined");
done();
});
});
it('should support namespaced async functions', function(done) {

@@ -103,0 +129,0 @@

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