mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
22792c8632
PR-URL: https://github.com/nodejs/node/pull/41414 Fixes: https://github.com/nodejs/node/issues/41391 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
29 lines
818 B
JavaScript
29 lines
818 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const domain = require('domain');
|
|
const EventEmitter = require('events');
|
|
|
|
const d = new domain.Domain();
|
|
const e = new EventEmitter();
|
|
|
|
d.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'foobar');
|
|
assert.strictEqual(err.domain, d);
|
|
assert.strictEqual(err.domainEmitter, e);
|
|
assert.strictEqual(err.domainBound, undefined);
|
|
assert.strictEqual(err.domainThrown, false);
|
|
}));
|
|
|
|
d.add(e);
|
|
e.emit('error', new Error('foobar'));
|
|
|
|
{
|
|
// Ensure initial params pass to origin `EventEmitter.init` function
|
|
const e = new EventEmitter({ captureRejections: true });
|
|
const kCapture = Object.getOwnPropertySymbols(e)
|
|
.find((it) => it.description === 'kCapture');
|
|
assert.strictEqual(e[kCapture], true);
|
|
}
|