Skip to content

Commit

Permalink
docs: add info to toThrowError (#2447)
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow committed Jan 9, 2023
1 parent d40a60c commit 532cc11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/api/index.md
Expand Up @@ -1181,6 +1181,8 @@ You cannot use this syntax, when using Vitest as [type checker](/guide/testing-t

- **Type:** `(received: any) => Awaitable<void>`

- **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:
Expand Down Expand Up @@ -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:** `<T>(shape?: Partial<T> | string, message?: string) => void`
Expand Down

0 comments on commit 532cc11

Please sign in to comment.