diff --git a/test/common/index.js b/test/common/index.js index 8efd72fc7d162a..2ff682e95d1347 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -691,6 +691,11 @@ exports.expectsError = function expectsError(fn, settings, exact) { fn = undefined; } function innerFn(error) { + if (arguments.length !== 1) { + // Do not use `assert.strictEqual()` to prevent `util.inspect` from + // always being called. + assert.fail(`Expected one argument, got ${util.inspect(arguments)}`); + } assert.strictEqual(error.code, settings.code); const descriptor = Object.getOwnPropertyDescriptor(error, 'message'); assert.strictEqual(descriptor.enumerable,