Skip to content

Commit bd7e1a0

Browse files
committed
domain: add name to monkey-patched emit function
The domain module monkey patches EventEmitter.prototype.emit(), however the function's name was becoming the empty string. This commit forces the new emit function to have the proper name.
1 parent d1640dd commit bd7e1a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/domain.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ EventEmitter.init = function() {
456456
};
457457

458458
const eventEmit = EventEmitter.prototype.emit;
459-
EventEmitter.prototype.emit = function(...args) {
459+
EventEmitter.prototype.emit = function emit(...args) {
460460
const domain = this.domain;
461461

462462
const type = args[0];

test/parallel/test-domain-dep0097.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const inspector = require('inspector');
99

1010
process.on('warning', common.mustCall((warning) => {
1111
assert.strictEqual(warning.code, 'DEP0097');
12-
assert.match(warning.message, /Triggered by calling <anonymous> on process/);
12+
assert.match(warning.message, /Triggered by calling emit on process/);
1313
}));
1414

1515
domain.create().run(() => {

0 commit comments

Comments
 (0)