Skip to content

Commit

Permalink
test: simplify common.expectsError
Browse files Browse the repository at this point in the history
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: #17616
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
  • Loading branch information
BridgeAR committed Dec 12, 2017
1 parent e17dba7 commit 8d5b3de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 8d5b3de

Please sign in to comment.