node/test/parallel/test-domain-dep0097.js
cjihrig 152de34fb1
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.

PR-URL: https://github.com/nodejs/node/pull/37550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-03-03 12:51:15 -05:00

18 lines
427 B
JavaScript

'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();
});