mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
1a2f579ba0
Split up test-domain into multiple, more focused test files and use more modern JS inside of them. PR-URL: https://github.com/nodejs/node/pull/13614 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
32 lines
852 B
JavaScript
32 lines
852 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const domain = require('domain');
|
|
const fs = require('fs');
|
|
|
|
{
|
|
const d = new domain.Domain();
|
|
|
|
d.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foobar');
|
|
assert.strictEqual(err.domain, d);
|
|
assert.strictEqual(err.domainEmitter, undefined);
|
|
assert.strictEqual(err.domainBound, undefined);
|
|
assert.strictEqual(err.domainThrown, true);
|
|
}));
|
|
|
|
d.run(common.mustCall(() => {
|
|
process.nextTick(common.mustCall(() => {
|
|
const i = setInterval(common.mustCall(() => {
|
|
clearInterval(i);
|
|
setTimeout(common.mustCall(() => {
|
|
fs.stat('this file does not exist', common.mustCall((er, stat) => {
|
|
throw new Error('foobar');
|
|
}));
|
|
}), 1);
|
|
}), 1);
|
|
}));
|
|
}));
|
|
}
|