Skip to content
Prev Previous commit
Next Next commit
test: improve test-vm-new-script-new-context
  • Loading branch information
jasnell committed Aug 1, 2017
commit 29e257672e1b351c80b030fb58dd4527202e56da
8 changes: 4 additions & 4 deletions test/parallel/test-vm-new-script-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ const Script = require('vm').Script;

{
const script = new Script('throw new Error(\'test\');');
assert.throws(function() {
assert.throws(() => {
script.runInNewContext();
}, /^Error: test$/);
}

{
const script = new Script('foo.bar = 5;');
assert.throws(function() {
assert.throws(() => {
script.runInNewContext();
}, /^ReferenceError: foo is not defined$/);
}
Expand Down Expand Up @@ -94,14 +94,14 @@ const Script = require('vm').Script;
script.runInNewContext({ f: f });
assert.strictEqual(f.a, 2);

assert.throws(function() {
assert.throws(() => {
script.runInNewContext();
}, /^ReferenceError: f is not defined$/);
}

{
const script = new Script('');
assert.throws(function() {
assert.throws(() => {
script.runInNewContext.call('\'hello\';');
}, /^TypeError: this\.runInContext is not a function$/);
}