rejects
Summary
Asserts that the promise returned by fn (or the promise itself) rejects.
Accepts the same expectedError shapes as throws.
Signature
function rejects(
fn: (() => Promise<any>) | Promise<any>,
expectedError: any,
message: string,
): Promise<void>;
Example
await assert.rejects(fetch('/missing'), (err) => err.status === 404)Params
fn
A function returning a promise, or a promise directly.
expectedError
Optional error constructor, instance, RegExp, or validator.
message
Optional failure message.