Jest · Module
rejects
Use expect(promise).rejects to test that an asynchronous operation fails. Return the assertion or await it so Jest waits for the rejection check.
Last updated
Syntax
await expect(promise).rejects.matcher(expected)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expectresolvestoMatchtoEqualassertionsasyncawaitcatch