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
17 changes: 17 additions & 0 deletions test/known_issues/test-vm-strict-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';
// https://github.com/nodejs/node/issues/12300

require('../common');
const assert = require('assert');
const vm = require('vm');

const ctx = vm.createContext({ x: 42 });

// The following line wrongly throws an
// error because GlobalPropertySetterCallback()
// does not check if the property exists
// on the sandbox. It should just set x to 1
// instead of throwing an error.
vm.runInContext('"use strict"; x = 1', ctx);

assert.strictEqual(ctx.x, 1);