diff --git a/test/known_issues/test-vm-strict-mode.js b/test/known_issues/test-vm-strict-mode.js new file mode 100644 index 0000000000..9528944732 --- /dev/null +++ b/test/known_issues/test-vm-strict-mode.js @@ -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);