test: refactor test-vm-new-script-new-context
Changed the second parameter of assert.throws to match the errors. PR-URL: https://github.com/nodejs/node/pull/13035 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
29d89c9855
commit
a593c74f81
@ -38,14 +38,14 @@ console.error('thrown error');
|
|||||||
script = new Script('throw new Error(\'test\');');
|
script = new Script('throw new Error(\'test\');');
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
script.runInNewContext();
|
script.runInNewContext();
|
||||||
}, /test/);
|
}, /^Error: test$/);
|
||||||
|
|
||||||
|
|
||||||
console.error('undefined reference');
|
console.error('undefined reference');
|
||||||
script = new Script('foo.bar = 5;');
|
script = new Script('foo.bar = 5;');
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
script.runInNewContext();
|
script.runInNewContext();
|
||||||
}, /not defined/);
|
}, /^ReferenceError: foo is not defined$/);
|
||||||
|
|
||||||
|
|
||||||
global.hello = 5;
|
global.hello = 5;
|
||||||
@ -82,9 +82,9 @@ assert.strictEqual(f.a, 2);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
script.runInNewContext();
|
script.runInNewContext();
|
||||||
}, /f is not defined/);
|
}, /^ReferenceError: f is not defined$/);
|
||||||
|
|
||||||
console.error('invalid this');
|
console.error('invalid this');
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
script.runInNewContext.call('\'hello\';');
|
script.runInNewContext.call('\'hello\';');
|
||||||
}, TypeError);
|
}, /^TypeError: this\.runInContext is not a function$/);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user