From 67d9a86f16a7a6fef6a8eb85d83da20b881ae99a Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 11 Dec 2017 06:34:57 -0200 Subject: [PATCH] test: simplify common.expectsError The mustCall is actually only necessary in case it is used as callback. Otherwise it works as a must call on its own. PR-URL: https://github.com/nodejs/node/pull/17616 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss --- test/common/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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() {