mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
647 B
21 lines
647 B
// 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');
|
|
}));
|
|
|
|
e.on('event-type', function() {});
|
|
e.on('event-type', function() {});
|
|
|