Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
test: fixed test case for v8
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalspathak committed Aug 2, 2017
1 parent f9a5056 commit d17a3dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
3 changes: 1 addition & 2 deletions test/message/nexttick_throw.v8.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
*test*message*nexttick_throw.js:*
*undefined_reference_error_maker;
*^
ReferenceError: *undefined_reference_error_maker*
ReferenceError: *undefined_reference_error_maker is not defined*
*at *test*message*nexttick_throw.js:*:*
*at _combinedTickCallback (internal/process/next_tick.js:*:*)
*at *_tickCallback (internal/process/next_tick.js:*:*)
*at Module.runMain (module.js:*:*)
*at run (bootstrap_node.js:*:*)
*at startup (bootstrap_node.js:*:*)
*at *bootstrap_node.js:*:*
34 changes: 17 additions & 17 deletions test/parallel/test-vm-new-script-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ const Script = require('vm').Script;
}

{
assert.throws(
function() {
script.runInNewContext();
},
common.engineSpecificMessage({
v8: /^ReferenceError: foo is not defined$/,
chakracore: /ReferenceError: Use before declaration/
}));
const script = new Script('foo.bar = 5;');
assert.throws(function() {
script.runInNewContext();
}, common.engineSpecificMessage({
v8: /^ReferenceError: foo is not defined$/,
chakracore: /^TypeError: Unable to set property 'bar' of undefined or null reference$/
}));
}

{
global.hello = 5;
const script = new Script('hello = 2');
script.runInNewContext();
Expand Down Expand Up @@ -95,14 +97,12 @@ const Script = require('vm').Script;
script.runInNewContext({ f: f });
assert.strictEqual(f.a, 2);

assert.throws(
function() {
script.runInNewContext();
},
common.engineSpecificMessage({
v8: /^ReferenceError: f is not defined$/,
chakracore: /'a' of undefined or null/
}));
assert.throws(function() {
script.runInNewContext();
}, common.engineSpecificMessage({
v8: /^ReferenceError: f is not defined$/,
chakracore: /^TypeError: Unable to set property 'a' of undefined or null reference$/
}));
}

{
Expand All @@ -111,6 +111,6 @@ const Script = require('vm').Script;
script.runInNewContext.call('\'hello\';');
}, common.engineSpecificMessage({
v8: /^TypeError: this\.runInContext is not a function$/,
chakracore: /TypeError: Object doesn't support property or method 'runInContext'/
chakracore: /^TypeError: Object doesn't support property or method 'runInContext'$/
}));
}

0 comments on commit d17a3dc

Please sign in to comment.