diff --git a/lib/assert.js b/lib/assert.js index 9c900fcaf32..8d22906c5ff 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -465,7 +465,9 @@ async function waitForActual(block) { function expectsError(stackStartFn, actual, error, message) { if (typeof error === 'string') { if (arguments.length === 4) { - throw new ERR_INVALID_ARG_TYPE('error', ['Function', 'RegExp'], error); + throw new ERR_INVALID_ARG_TYPE('error', + ['Object', 'Error', 'Function', 'RegExp'], + error); } message = error; error = null; diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 54972657e94..66851fa5ea7 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -741,8 +741,8 @@ common.expectsError( { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, - message: 'The "error" argument must be one of type Function or RegExp. ' + - 'Received type string' + message: 'The "error" argument must be one of type Object, Error, ' + + 'Function, or RegExp. Received type string' } );