diff --git a/lib/helper.js b/lib/helper.js index 1fcb9dbf272..aa68e5b2370 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -145,7 +145,7 @@ class Helper { const method = Reflect.get(classType.prototype, 'emit'); Reflect.set(classType.prototype, 'emit', function(event, ...args) { let argsText = [JSON.stringify(event)].concat(args.map(stringifyArgument)).join(', '); - if (debug.enabled) + if (debug.enabled && this.listenerCount(event)) debug(`${className}.emit(${argsText})`); if (apiCoverage && this.listenerCount(event)) apiCoverage.set(`${className}.emit(${JSON.stringify(event)})`, true);