test: proposal common.expectsError nextTick option #29749
Closed
Description
I would like to propose a new option for common.expectsError
which will indicate whether the error
can be invoked in the same tick or not, e.g.
I would like to be able to replace tests like this:
let ticked = false;
stream.write(null, common.mustCall((err) => {
assert.strictEqual(ticked, true);
common.expectsError(opts)(err);
}));
ticked = true;
with
stream.write(null, common.expectsError({
...opts,
nextTick: true
});
Would this make sense? It's quite often that one wants to test for callback errors and that they should be invoked asynchronously.
I think this would also help us actually making sure that callbacks are invoked asynchronously.
NOTE: Can I use expectsError
to test for no error?
Metadata
Assignees
Labels
No labels
Activity