mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
56 lines
1.1 KiB
Markdown
56 lines
1.1 KiB
Markdown
---
|
|
title: Recipes | Guide
|
|
---
|
|
|
|
# Recipes
|
|
|
|
## Disabling isolation for specific test files only
|
|
|
|
You can speed up your test run by disabling isolation for specific set of files by specifying `isolate` per `projects` entries:
|
|
|
|
```ts [vitest.config.ts]
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
projects: [
|
|
{
|
|
// Non-isolated unit tests
|
|
name: 'Unit tests',
|
|
isolate: false,
|
|
exclude: ['**.integration.test.ts'],
|
|
},
|
|
{
|
|
// Isolated integration tests
|
|
name: 'Integration tests',
|
|
include: ['**.integration.test.ts'],
|
|
},
|
|
],
|
|
},
|
|
})
|
|
```
|
|
|
|
## Parallel and Sequential test files
|
|
|
|
You can split test files into parallel and sequential groups by using `projects` option:
|
|
|
|
```ts [vitest.config.ts]
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
projects: [
|
|
{
|
|
name: 'Parallel',
|
|
exclude: ['**.sequantial.test.ts'],
|
|
},
|
|
{
|
|
name: 'Sequential',
|
|
include: ['**.sequantial.test.ts'],
|
|
fileParallelism: false,
|
|
},
|
|
],
|
|
},
|
|
})
|
|
```
|