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>
v4.x
Ken Russo 8 years ago
committed by Myles Borins
parent
commit
11115c0d85
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  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'; 'use strict';
const common = require('../common'); const common = require('../common');
var assert = require('assert'); const assert = require('assert');
var events = require('events'); const events = require('events');
var e = new events.EventEmitter(); const e = new events.EventEmitter();
e.on('maxListeners', common.mustCall(function() {})); e.on('maxListeners', common.mustCall(function() {}));
@ -11,14 +11,14 @@ e.setMaxListeners(42);
assert.throws(function() { assert.throws(function() {
e.setMaxListeners(NaN); e.setMaxListeners(NaN);
}); }, /^TypeError: n must be a positive number$/);
assert.throws(function() { assert.throws(function() {
e.setMaxListeners(-1); e.setMaxListeners(-1);
}); }, /^TypeError: n must be a positive number$/);
assert.throws(function() { assert.throws(function() {
e.setMaxListeners('and even this'); e.setMaxListeners('and even this');
}); }, /^TypeError: n must be a positive number$/);
e.emit('maxListeners'); e.emit('maxListeners');

Loading…
Cancel
Save