node/test/parallel/test-shadow-realm.js
legendecas e86a638305
src: add initial shadow realm support
Add initial shadow realm support behind an off-by-default flag
`--experimental-shadow-realm`.

PR-URL: https://github.com/nodejs/node/pull/42869
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-05-02 18:46:31 +02:00

13 lines
402 B
JavaScript

// Flags: --experimental-shadow-realm
'use strict';
require('../common');
const assert = require('assert');
// Validates we can construct ShadowRealm successfully.
const shadowRealm = new ShadowRealm();
const getter = shadowRealm.evaluate('globalThis.realmValue = "inner"; () => globalThis.realmValue;');
assert.strictEqual(getter(), 'inner');
assert.strictEqual('realmValue' in globalThis, false);