node/test/parallel/test-vm-global-assignment.js
Anna Henningsen 1ef38e9fed
test: add regression tests for vm bugs
Add the regression test script presented in
https://github.com/nodejs/node/issues/10806 to `test/parallel` and
re-add the original regression test for
https://github.com/nodejs/node/issues/10223 in `test/known_issues`.

PR-URL: https://github.com/nodejs/node/pull/10920
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-01-25 15:44:29 -08:00

16 lines
440 B
JavaScript

'use strict';
// Regression test for https://github.com/nodejs/node/issues/10806
require('../common');
const assert = require('assert');
const vm = require('vm');
const ctx = vm.createContext({ open() { } });
const window = vm.runInContext('this', ctx);
const other = 123;
assert.notStrictEqual(window.open, other);
window.open = other;
assert.strictEqual(window.open, other);
window.open = other;
assert.strictEqual(window.open, other);