Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/parallel/test-vm-static-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const vm = require('vm');

// Run a string
const result = vm.runInThisContext('\'passed\';');
assert.strictEqual('passed', result);
assert.strictEqual(result, 'passed');

// thrown error
assert.throws(function() {
Expand All @@ -35,7 +35,7 @@ assert.throws(function() {

global.hello = 5;
vm.runInThisContext('hello = 2');
assert.strictEqual(2, global.hello);
assert.strictEqual(global.hello, 2);


// pass values
Expand All @@ -48,14 +48,14 @@ global.obj = { foo: 0, baz: 3 };
/* eslint-disable no-unused-vars */
const baz = vm.runInThisContext(code);
/* eslint-enable no-unused-vars */
assert.strictEqual(0, global.obj.foo);
assert.strictEqual(2, global.bar);
assert.strictEqual(1, global.foo);
assert.strictEqual(global.obj.foo, 0);
assert.strictEqual(global.bar, 2);
assert.strictEqual(global.foo, 1);

// call a function
global.f = function() { global.foo = 100; };
vm.runInThisContext('f()');
assert.strictEqual(100, global.foo);
assert.strictEqual(global.foo, 100);

common.allowGlobals(
global.hello,
Expand Down