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 and RafaelGSS committed Nov 10, 2022
1 parent aa4152a commit eed799b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/parallel/test-event-capture-rejections.js
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 eed799b

Please sign in to comment.