mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 18:29:06 +00:00

Allows Symbol to be converted to String so it can be included in the error. Fixes: https://github.com/nodejs/node/issues/9003 PR-URL: https://github.com/nodejs/node/pull/9021 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
23 lines
719 B
JavaScript
23 lines
719 B
JavaScript
// Flags: --no-warnings
|
|
// The flag suppresses stderr output but the warning event will still emit
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const events = require('events');
|
|
const assert = require('assert');
|
|
|
|
const e = new events.EventEmitter();
|
|
e.setMaxListeners(1);
|
|
|
|
process.on('warning', common.mustCall((warning) => {
|
|
assert.ok(warning instanceof Error);
|
|
assert.strictEqual(warning.name, 'MaxListenersExceededWarning');
|
|
assert.strictEqual(warning.emitter, e);
|
|
assert.strictEqual(warning.count, 2);
|
|
assert.strictEqual(warning.type, 'event-type');
|
|
assert.ok(warning.message.includes('2 event-type listeners added.'));
|
|
}));
|
|
|
|
e.on('event-type', function() {});
|
|
e.on('event-type', function() {});
|