Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function emitMakeCallbackDeprecation({ target, method }) {
'Using a domain property in MakeCallback is deprecated. Use the ' +
'async_context variant of MakeCallback or the AsyncResource class ' +
'instead. ' +
`(Triggered by calling ${method?.name ?? '<anonymous>'} ` +
`(Triggered by calling ${method?.name || '<anonymous>'} ` +
`on ${target?.constructor?.name}.)`,
'DeprecationWarning', 'DEP0097');
sendMakeCallbackDeprecation = true;
Expand Down Expand Up @@ -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];
Expand Down
17 changes: 17 additions & 0 deletions test/parallel/test-domain-dep0097.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const assert = require('assert');
const domain = require('domain');
const inspector = require('inspector');

process.on('warning', common.mustCall((warning) => {
assert.strictEqual(warning.code, 'DEP0097');
assert.match(warning.message, /Triggered by calling emit on process/);
}));

domain.create().run(() => {
inspector.open();
});