You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
470 B

'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);