Skip to content

Commit d416a59

Browse files
committed
test: make use of globals explicit
Use `global` to be explicit that a global variable is intended. PR-URL: nodejs#6014 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ae2be27 commit d416a59

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/parallel/test-vm-static-this.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ assert.throws(function() {
1414
vm.runInThisContext('throw new Error(\'test\');');
1515
}, /test/);
1616

17-
hello = 5;
17+
global.hello = 5;
1818
vm.runInThisContext('hello = 2');
19-
assert.equal(2, hello);
19+
assert.equal(2, global.hello);
2020

2121

2222
console.error('pass values');
23-
code = 'foo = 1;' +
23+
var code = 'foo = 1;' +
2424
'bar = 2;' +
2525
'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');';
26-
foo = 2;
27-
obj = { foo: 0, baz: 3 };
26+
global.foo = 2;
27+
global.obj = { foo: 0, baz: 3 };
2828
/* eslint-disable no-unused-vars */
2929
var baz = vm.runInThisContext(code);
3030
/* eslint-enable no-unused-vars */
31-
assert.equal(0, obj.foo);
32-
assert.equal(2, bar);
33-
assert.equal(1, foo);
31+
assert.equal(0, global.obj.foo);
32+
assert.equal(2, global.bar);
33+
assert.equal(1, global.foo);
3434

3535
console.error('call a function');
36-
f = function() { foo = 100; };
36+
global.f = function() { global.foo = 100; };
3737
vm.runInThisContext('f()');
38-
assert.equal(100, foo);
38+
assert.equal(100, global.foo);

0 commit comments

Comments
 (0)