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 authored and MylesBorins committed Jan 22, 2018
1 parent 068d52d commit 337d93a
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 @@ -737,7 +737,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 @@ -770,12 +770,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 337d93a

Please sign in to comment.