mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
docs: add information to the workspace docs on how to use extends (#6169)
Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
This commit is contained in:
parent
93882f388e
commit
17a81f099b
@ -156,7 +156,7 @@ npm run test --project e2e --project unit
|
||||
|
||||
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:
|
||||
|
||||
:::code-group
|
||||
::: code-group
|
||||
```ts [packages/a/vitest.config.ts]
|
||||
import { defineProject, mergeConfig } from 'vitest/config'
|
||||
import configShared from '../vitest.shared.js'
|
||||
@ -172,6 +172,30 @@ export default mergeConfig(
|
||||
```
|
||||
:::
|
||||
|
||||
At the `defineWorkspace` level you can also use the `extends` option instead to inherit from your root-level config.
|
||||
::: code-group
|
||||
```ts [packages/a/vitest.config.ts]
|
||||
import { defineWorkspace } from 'vitest/config'
|
||||
|
||||
export default defineWorkspace([
|
||||
{
|
||||
extends: './vitest.config.ts',
|
||||
test: {
|
||||
name: 'unit',
|
||||
include: ['**/*.unit.test.ts'],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: './vitest.config.ts',
|
||||
test: {
|
||||
name: 'integration',
|
||||
include: ['**/*.integration.test.ts'],
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
:::
|
||||
|
||||
Also, some of the configuration options are not allowed in a project config. Most notably:
|
||||
|
||||
- `coverage`: coverage is done for the whole workspace
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user