Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: add common.mustSucceed
  • Loading branch information
tniessen committed Oct 13, 2020
commit ce9389a097552ae7144b2ea82d2057a70e1cf900
9 changes: 9 additions & 0 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ function mustCall(fn, exact) {
return _mustCallInner(fn, exact, 'exact');
}

function mustSucceed(fn, exact) {
return mustCall(function(err, ...args) {
assert.ifError(err);
if (typeof fn === 'function')
return fn.apply(this, args);
}, exact);
}

function mustCallAtLeast(fn, minimum) {
return _mustCallInner(fn, minimum, 'minimum');
}
Expand Down Expand Up @@ -714,6 +722,7 @@ const common = {
mustCall,
mustCallAtLeast,
mustNotCall,
mustSucceed,
nodeProcessAborted,
PIPE,
platformTimeout,
Expand Down