1'use strict'; 2 3require('../common'); 4const vm = require('vm'); 5const assert = require('assert'); 6 7const sym1 = Symbol('1'); 8const sym2 = Symbol('2'); 9const sandbox = { 10 a: true, 11 [sym1]: true 12}; 13Object.defineProperty(sandbox, 'b', { value: true }); 14Object.defineProperty(sandbox, sym2, { value: true }); 15 16const ctx = vm.createContext(sandbox); 17 18// Sanity check 19// Please uncomment these when the test is no longer broken 20// assert.deepStrictEqual(Reflect.ownKeys(sandbox), ['a', 'b', sym1, sym2]); 21// assert.deepStrictEqual(Object.getOwnPropertyNames(sandbox), ['a', 'b']); 22// assert.deepStrictEqual(Object.getOwnPropertySymbols(sandbox), [sym1, sym2]); 23 24const nativeSym = vm.runInNewContext('Object.getOwnPropertySymbols(this);'); 25const ownSym = vm.runInContext('Object.getOwnPropertySymbols(this);', ctx); 26const restSym = ownSym.filter((sym) => !nativeSym.includes(sym)); 27// This should not fail 28assert.deepStrictEqual(Array.from(restSym), [sym1, sym2]); 29