Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,31 @@ test('add item', ({ todos }) => {
})
```

## test.scoped <Version>3.1.0</Version> {#test-scoped}

- **Alias:** `it.scoped`

Use `test.scoped` to override fixture values for all tests within the current suite and its nested suites. This must be called at the top level of a `describe` block. See [Scoping Values to Suite](/guide/test-context.html#scoping-values-to-suite) for more information.

```ts
import { test as baseTest, describe, expect } from 'vitest'

const test = baseTest.extend({
dependency: 'default',
dependant: ({ dependency }, use) => use({ dependency }),
})

describe('use scoped values', () => {
test.scoped({ dependency: 'new' })

test('uses scoped value', ({ dependant }) => {
// `dependant` uses the new overridden value that is scoped
// to all tests in this suite
expect(dependant).toEqual({ dependency: 'new' })
})
})
```

## test.skip

- **Alias:** `it.skip`
Expand Down
6 changes: 2 additions & 4 deletions guide/test-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ title: Test Tags | Guide
outline: deep
---

<!-- TODO: translation -->
# Test Tags <Version>4.1.0</Version> {#test-tags}

# Test Tags <Version>4.1.0</Version>

[`Tags`](/config/tags) allow you to mark tests and change their options based on the tag's definition.
[`Tags`](/config/tags) let you label tests so you can filter what runs and override their options when needed.

## Defining Tags

Expand Down