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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,14 @@ jobs:
run: pnpm run build

- name: Test
run: pnpm run test:ci
run: pnpm run test:ci:no-bail

- name: Test Examples
if: ${{ !cancelled() }}
run: pnpm run test:examples

- name: Test Browser (playwright)
if: ${{ !cancelled() }}
run: pnpm run test:browser:playwright

- uses: actions/upload-artifact@v6
Expand Down
25 changes: 25 additions & 0 deletions docs/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,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
4 changes: 2 additions & 2 deletions docs/guide/test-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Test Tags | Guide
outline: deep
---

# Test Tags <Version>4.1.0</Version>
# Test Tags <Version>4.1.0</Version> {#test-tags}

[`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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"release": "tsx scripts/release.ts",
"test": "pnpm --filter test-core test:threads",
"test:ci": "CI=true pnpm -r --reporter-hide-prefix --stream --sequential --filter '@vitest/test-*' --filter !test-browser run test",
"test:ci:no-bail": "CI=true pnpm -r --no-bail --reporter-hide-prefix --stream --sequential --filter '@vitest/test-*' --filter !test-browser run test",
"test:ci:cache": "CI=true pnpm -r --reporter-hide-prefix --stream --sequential --filter '@vitest/test-*' --filter !test-browser --filter !test-dts-config --filter !test-dts-fixture --filter !test-dts-playwright --filter !test-ui --filter !test-cache run test --experimental.fsModuleCache",
"test:examples": "CI=true pnpm -r --reporter-hide-prefix --stream --filter '@vitest/example-*' run test",
"test:ecosystem-ci": "ECOSYSTEM_CI=true pnpm test:ci",
Expand Down
Loading