0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-vm-proxies.js
Tobias Nießen db9c556f50
test: use shorthand properties
PR-URL: https://github.com/nodejs/node/pull/18105
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-17 14:33:20 +01:00

19 lines
639 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const vm = require('vm');
// src/node_contextify.cc filters out the Proxy object from the parent
// context. Make sure that the new context has a Proxy object of its own.
let sandbox = {};
vm.runInNewContext('this.Proxy = Proxy', sandbox);
assert.strictEqual(typeof sandbox.Proxy, 'function');
assert.notStrictEqual(sandbox.Proxy, Proxy);
// Unless we copy the Proxy object explicitly, of course.
sandbox = { Proxy };
vm.runInNewContext('this.Proxy = Proxy', sandbox);
assert.strictEqual(typeof sandbox.Proxy, 'function');
assert.strictEqual(sandbox.Proxy, Proxy);