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 <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
  • Loading branch information
BridgeAR authored and MylesBorins committed Dec 21, 2017
1 parent e58a5ca commit 70588f7
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 70588f7

Please sign in to comment.