diff --git a/docs/api/index.md b/docs/api/index.md index d12531ec4c76..fa00357268d1 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -1181,6 +1181,8 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t - **Type:** `(received: any) => Awaitable` +- **Alias:** `toThrow` + `toThrowError` asserts if a function throws an error when it is called. For example, if we want to test that `getFruitStock('pineapples')` throws, we could write: @@ -1216,6 +1218,10 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t }) ``` + :::tip + To test async functions, use in combination with [rejects](#rejects). + ::: + ### toMatchSnapshot - **Type:** `(shape?: Partial | string, message?: string) => void`