blob: 41aed1ee337df474fca678cd4cde022386311279 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
'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');
}
|