From d3cc9c1dbd40f4158b2f08fea9f3a23076064e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Mon, 24 Oct 2022 08:35:08 -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 --- 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() {