mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Promote DEP0032 from a documentation-only deprecation to a runtime deprecation. Loading the `node:domain` module now emits a DeprecationWarning with code DEP0032, and the docs are updated to reflect the Runtime deprecation type. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/65074 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
// Flags: --no-deprecation
|
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const domain = require('domain');
|
|
const fs = require('fs');
|
|
const isEnumerable = Function.call.bind(Object.prototype.propertyIsEnumerable);
|
|
|
|
process.on('warning', common.mustNotCall());
|
|
|
|
{
|
|
const d = new domain.Domain();
|
|
|
|
d.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foobar');
|
|
assert.strictEqual(err.domain, d);
|
|
assert.strictEqual(isEnumerable(err, 'domain'), false);
|
|
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);
|
|
}));
|
|
}));
|
|
}
|