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() {