mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
660d17dde7
PR-URL: https://github.com/nodejs/node/pull/43556 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
29 lines
710 B
JavaScript
29 lines
710 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const domain = require('domain');
|
|
const vm = require('vm');
|
|
|
|
// A promise created in a VM should not include a domain field but
|
|
// domains should still be able to propagate through them.
|
|
//
|
|
// See; https://github.com/nodejs/node/issues/40999
|
|
|
|
const context = vm.createContext({});
|
|
|
|
function run(code) {
|
|
const d = domain.createDomain();
|
|
d.run(common.mustCall(() => {
|
|
const p = vm.runInContext(code, context)();
|
|
assert.strictEqual(p.domain, undefined);
|
|
p.then(common.mustCall(() => {
|
|
assert.strictEqual(process.domain, d);
|
|
}));
|
|
}));
|
|
}
|
|
|
|
for (let i = 0; i < 1000; i++) {
|
|
run('async () => null');
|
|
}
|