Skip to content

Commit d718c67

Browse files
juanarboldanielleadams
authored andcommitted
test: improve test coverage in test-event-capture-rejections.js
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>
1 parent 614d646 commit d718c67

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/parallel/test-event-capture-rejections.js

+15
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ const { inherits } = require('util');
99
function NoConstructor() {
1010
}
1111

12+
// captureRejections param validation
13+
{
14+
[1, [], function() {}, {}, Infinity, Math.PI, 'meow'].forEach((arg) => {
15+
assert.throws(
16+
() => new EventEmitter({ captureRejections: arg }),
17+
{
18+
name: 'TypeError',
19+
code: 'ERR_INVALID_ARG_TYPE',
20+
message: 'The "options.captureRejections" property must be of type boolean.' +
21+
common.invalidArgTypeHelper(arg)
22+
}
23+
);
24+
});
25+
}
26+
1227
inherits(NoConstructor, EventEmitter);
1328

1429
function captureRejections() {

0 commit comments

Comments
 (0)