Skip to content

Commit 10200f3

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 b54c8c5 commit 10200f3

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
@@ -5,7 +5,7 @@ const domain = require('domain');
55

66
process.on('warning', common.mustCall((warning) => {
77
assert.strictEqual(warning.code, 'DEP0097');
8-
assert.match(warning.message, /Triggered by calling <anonymous> on process/);
8+
assert.match(warning.message, /Triggered by calling emit on process/);
99
}));
1010

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

0 commit comments

Comments
 (0)