From eed799bd313b393454af2951f98116b07b657862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9?= Date: Sat, 29 Oct 2022 17:48:11 -0500 Subject: [PATCH] test: improve test coverage in `test-event-capture-rejections.js` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juan José Arboleda PR-URL: https://github.com/nodejs/node/pull/45148 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli --- test/parallel/test-event-capture-rejections.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/parallel/test-event-capture-rejections.js b/test/parallel/test-event-capture-rejections.js index 233b6b35d55072..b6dad65d364854 100644 --- a/test/parallel/test-event-capture-rejections.js +++ b/test/parallel/test-event-capture-rejections.js @@ -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() {