Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net> PR-URL: https://github.com/nodejs/node/pull/62322 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
18 lines
451 B
JavaScript
18 lines
451 B
JavaScript
'use strict';
|
|
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
|
|
|
// This verifies that the addon-created context has an independent
|
|
// global object.
|
|
{
|
|
const ctx = binding.makeContext();
|
|
const result = binding.runInContext(ctx, `
|
|
globalThis.foo = 'bar';
|
|
foo;
|
|
`);
|
|
assert.strictEqual(result, 'bar');
|
|
assert.strictEqual(globalThis.foo, undefined);
|
|
}
|