mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
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 <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
1 parent
068d52d667
commit
337d93abe5
1 file changed
+3
-3
@@ -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;
|
||||
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user