Vitest · Module
rejects
expect(promise).rejects checks the reason for a rejected promise. Await the matcher because the assertion is asynchronous.
Last updated
Syntax
await expect(promise).rejects.toThrow(expected)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expectresolvestoThrowtoThrowErrorexpect.assertions