diff --git a/test/common/index.js b/test/common/index.js index 3bc3500516ca06..0767b0226cb9f9 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -735,7 +735,7 @@ exports.expectsError = function expectsError(fn, settings, exact) { settings = fn; fn = undefined; } - const innerFn = exports.mustCall(function(error) { + function innerFn(error) { assert.strictEqual(error.code, settings.code); if ('type' in settings) { const type = settings.type; @@ -768,12 +768,12 @@ exports.expectsError = function expectsError(fn, settings, exact) { }); } return true; - }, exact); + } if (fn) { assert.throws(fn, innerFn); return; } - return innerFn; + return exports.mustCall(innerFn, exact); }; exports.skipIfInspectorDisabled = function skipIfInspectorDisabled() {