Asserts that given asynchronous function does reject the returned promise.
The function to call.
Optional
error: unknownOptional error to compare thrown exception to. If specified then assertion fails when function does not throw an exception equal to this one. If not specified then assertion fails when function does not throw anything.
Optional
reason: stringOptional reason added to exception message when assertion fails.
Promise which must be awaited in order to complete assertion.
AssertionError when function throws exception not matching the given one (or does not throw anything when no error specified).
The function to call.
Optional
error: unknownOptional error to compare thrown exception to. If specified then assertion fails when function does not throw an exception equal to this one. If not specified then assertion fails when function does not throw anything.
Optional
reason: stringOptional reason added to exception message when assertion fails.
AssertionError when function throws exception not matching the given one (or does not throw anything when no error specified).
Asserts that given function (synchronous or asynchronous) does throw an exception. When function is asynchronous then
assertThrow
returns a Promise which must be awaited in order to complete the assertion.Examples: