Skip to content

Commit

Permalink
docs: specify Vitest version for test.extend (#3683)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jun 27, 2023
1 parent a1e043b commit 47383eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api/index.md
Expand Up @@ -59,6 +59,7 @@ In Jest, `TestFunction` can also be of type `(done: DoneCallback) => void`. If t

- **Type:** `<T extends Record<string, any>>(fixtures: Fixtures<T>): TestAPI<ExtraContext & T>`
- **Alias:** `it.extend`
- **Version:** Vitest 0.32.3

Use `test.extend` to extend the test context with custom fixtures. This will return a new `test` and it's also extendable, so you can compose more fixtures or override existing ones by extending it as you need. See [Extend Test Context](/guide/test-context.html#test-extend) for more information.

Expand Down
4 changes: 4 additions & 0 deletions docs/guide/test-context.md
Expand Up @@ -35,6 +35,10 @@ Vitest provides two diffident ways to help you extend the test context.

### `test.extend`

::: warning
This API is available since Vitest 0.32.3.
:::

Like [Playwright](https://playwright.dev/docs/api/class-test#test-extend), you can use this method to define your own `test` API with custom fixtures and reuse it anywhere.

For example, we first create `myTest` with two fixtures, `todos` and `archive`.
Expand Down

0 comments on commit 47383eb

Please sign in to comment.