Skip to content

Commit

Permalink
test: improve test coverage in test-event-capture-rejections.js
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #45148
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
juanarbol authored Oct 29, 2022
1 parent e512786 commit cca44bc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/parallel/test-event-capture-rejections.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ const { inherits } = require('util');
function NoConstructor() {
}

// captureRejections param validation
{
[1, [], function() {}, {}, Infinity, Math.PI, 'meow'].forEach((arg) => {
assert.throws(
() => new EventEmitter({ captureRejections: arg }),
{
name: 'TypeError',
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "options.captureRejections" property must be of type boolean.' +
common.invalidArgTypeHelper(arg)
}
);
});
}

inherits(NoConstructor, EventEmitter);

function captureRejections() {
Expand Down

0 comments on commit cca44bc

Please sign in to comment.