From bd38dfbfcc5af7adb667c7e1c64e82c1e5a844fc Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 28 Feb 2021 14:38:16 -0500 Subject: [PATCH] domain: add name to monkey-patched emit function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. PR-URL: https://github.com/nodejs/node/pull/37550 Reviewed-By: Anna Henningsen Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Gerhard Stöbich Reviewed-By: James M Snell --- lib/domain.js | 2 +- test/parallel/test-domain-dep0097.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/domain.js b/lib/domain.js index 4e6cfcebc3aa51..acd5dc8221df31 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -456,7 +456,7 @@ EventEmitter.init = function() { }; const eventEmit = EventEmitter.prototype.emit; -EventEmitter.prototype.emit = function(...args) { +EventEmitter.prototype.emit = function emit(...args) { const domain = this.domain; const type = args[0]; diff --git a/test/parallel/test-domain-dep0097.js b/test/parallel/test-domain-dep0097.js index e877a4c47cc959..05b5c74b30d98e 100644 --- a/test/parallel/test-domain-dep0097.js +++ b/test/parallel/test-domain-dep0097.js @@ -9,7 +9,7 @@ const inspector = require('inspector'); process.on('warning', common.mustCall((warning) => { assert.strictEqual(warning.code, 'DEP0097'); - assert.match(warning.message, /Triggered by calling on process/); + assert.match(warning.message, /Triggered by calling emit on process/); })); domain.create().run(() => {