Skip to content
masterclass Buddy

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.

Subscribe
  • expect
  • resolves
  • toMatch
  • toEqual
  • assertions
  • async
  • await
  • catch

Source: Asynchronous Code · Jest. Checked 2026-11-03.