Browse Source

test: add second argument to assert.throws()

The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: https://github.com/nodejs/node/pull/9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Ken Russo 8 years ago
committed by James M Snell
parent
commit
1fddf5b6d6
  1. 12
      test/parallel/test-event-emitter-max-listeners.js

12
test/parallel/test-event-emitter-max-listeners.js

@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var events = require('events');
var e = new events.EventEmitter();
const assert = require('assert');
const events = require('events');
const e = new events.EventEmitter();
e.on('maxListeners', common.mustCall(function() {}));
@ -11,14 +11,14 @@ e.setMaxListeners(42);
assert.throws(function() {
e.setMaxListeners(NaN);
});
}, /^TypeError: "n" argument must be a positive number$/);
assert.throws(function() {
e.setMaxListeners(-1);
});
}, /^TypeError: "n" argument must be a positive number$/);
assert.throws(function() {
e.setMaxListeners('and even this');
});
}, /^TypeError: "n" argument must be a positive number$/);
e.emit('maxListeners');

Loading…
Cancel
Save