Skip to content

Commit 17a81f0

Browse files
docs: add information to the workspace docs on how to use extends (#6169)
Co-authored-by: Vladimir <[email protected]>
1 parent 93882f3 commit 17a81f0

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

docs/guide/workspace.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ npm run test --project e2e --project unit
156156

157157
None of the configuration options are inherited from the root-level config file. You can create a shared config file and merge it with the project config yourself:
158158

159-
:::code-group
159+
::: code-group
160160
```ts [packages/a/vitest.config.ts]
161161
import { defineProject, mergeConfig } from 'vitest/config'
162162
import configShared from '../vitest.shared.js'
@@ -172,6 +172,30 @@ export default mergeConfig(
172172
```
173173
:::
174174

175+
At the `defineWorkspace` level you can also use the `extends` option instead to inherit from your root-level config.
176+
::: code-group
177+
```ts [packages/a/vitest.config.ts]
178+
import { defineWorkspace } from 'vitest/config'
179+
180+
export default defineWorkspace([
181+
{
182+
extends: './vitest.config.ts',
183+
test: {
184+
name: 'unit',
185+
include: ['**/*.unit.test.ts'],
186+
},
187+
},
188+
{
189+
extends: './vitest.config.ts',
190+
test: {
191+
name: 'integration',
192+
include: ['**/*.integration.test.ts'],
193+
},
194+
},
195+
])
196+
```
197+
:::
198+
175199
Also, some of the configuration options are not allowed in a project config. Most notably:
176200

177201
- `coverage`: coverage is done for the whole workspace

0 commit comments

Comments
 (0)