test: add known issue for vm module · nodejs/node@1e231ba

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,17 @@

1+

'use strict';

2+

// https://github.com/nodejs/node/issues/12300

3+
4+

require('../common');

5+

const assert = require('assert');

6+

const vm = require('vm');

7+
8+

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

9+
10+

// The following line wrongly throws an

11+

// error because GlobalPropertySetterCallback()

12+

// does not check if the property exists

13+

// on the sandbox. It should just set x to 1

14+

// instead of throwing an error.

15+

vm.runInContext('"use strict"; x = 1', ctx);

16+
17+

assert.strictEqual(ctx.x, 1);