From 6f270d159321000bec51c0a260bd935d74ef09da Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sun, 25 Jan 2026 20:32:59 +0100 Subject: [PATCH 1/3] docs: add `test.scoped` to test api docs (#9524) --- api/test.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/api/test.md b/api/test.md index c44e890f..84c108bb 100644 --- a/api/test.md +++ b/api/test.md @@ -247,6 +247,31 @@ test('add item', ({ todos }) => { }) ``` +## test.scoped 3.1.0 {#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` From c70970f662a70dcc9c67c40222d66f680badc59d Mon Sep 17 00:00:00 2001 From: NoiseFan Date: Mon, 26 Jan 2026 03:33:24 +0800 Subject: [PATCH 2/3] docs: update `test-tags` feature introduction (#9518) --- guide/test-tags.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/test-tags.md b/guide/test-tags.md index 46367325..6e16f268 100644 --- a/guide/test-tags.md +++ b/guide/test-tags.md @@ -3,9 +3,9 @@ title: Test Tags | Guide outline: deep --- -# Test Tags 4.1.0 +# Test Tags 4.1.0 {#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 From 104bf4c741f5136dc99dd35072de15940c304f4b Mon Sep 17 00:00:00 2001 From: noise Date: Mon, 26 Jan 2026 17:10:11 +0800 Subject: [PATCH 3/3] docs(cn): dissolve the conflict --- guide/test-tags.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/guide/test-tags.md b/guide/test-tags.md index 061e9934..6e16f268 100644 --- a/guide/test-tags.md +++ b/guide/test-tags.md @@ -3,13 +3,7 @@ title: Test Tags | Guide outline: deep --- -<<<<<<< HEAD - - -# Test Tags 4.1.0 -======= # Test Tags 4.1.0 {#test-tags} ->>>>>>> c70970f662a70dcc9c67c40222d66f680badc59d [`Tags`](/config/tags) let you label tests so you can filter what runs and override their options when needed.