mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
1600869eb7
This commit fixes typos found in test files. PR-URL: https://github.com/nodejs/node/pull/42536 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const domain = require('domain');
|
|
|
|
// Make sure that when an error is thrown from a nested domain, its error
|
|
// handler runs outside of that domain, but within the context of any parent
|
|
// domain.
|
|
|
|
const d = domain.create();
|
|
const d2 = domain.create();
|
|
|
|
d2.on('error', common.mustCall((err) => {
|
|
if (domain._stack.length !== 1) {
|
|
console.error('domains stack length should be 1 but is %d',
|
|
domain._stack.length);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (process.domain !== d) {
|
|
console.error('active domain should be %j but is %j', d, process.domain);
|
|
process.exit(1);
|
|
}
|
|
|
|
process.nextTick(() => {
|
|
if (domain._stack.length !== 1) {
|
|
console.error('domains stack length should be 1 but is %d',
|
|
domain._stack.length);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (process.domain !== d) {
|
|
console.error('active domain should be %j but is %j', d,
|
|
process.domain);
|
|
process.exit(1);
|
|
}
|
|
});
|
|
}));
|
|
|
|
d.run(() => {
|
|
d2.run(() => {
|
|
throw new Error('oops');
|
|
});
|
|
});
|