Skip to content

Commit 14c5072

Browse files
authored
feat!: simplify default exclude pattern (#6287)
1 parent 176133e commit 14c5072

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

docs/config/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ When using coverage, Vitest automatically adds test files `include` patterns to
124124
### exclude
125125

126126
- **Type:** `string[]`
127-
- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']`
128-
- **CLI:** `vitest --exclude "**/excluded-file"`
127+
- **Default:** `['**/node_modules/**', '**/.git/**']`
128+
- **CLI:** `vitest --exclude "**/excluded-file" --exclude "*/other-files/*.js"`
129129

130130
A list of glob patterns that should be excluded from your test files.
131131

docs/guide/improving-performance.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export default defineConfig({
5252
```
5353
:::
5454

55+
## Limiting directory search
56+
57+
You can limit the working directory when Vitest searches for files using [`test.dir`](/config/#test-dir) option. This should make the search faster if you have unrelated folders and files in the root directory.
58+
5559
## Pool
5660

5761
By default Vitest runs tests in `pool: 'forks'`. While `'forks'` pool is better for compatibility issues ([hanging process](/guide/common-errors.html#failed-to-terminate-worker) and [segfaults](/guide/common-errors.html#segfaults-and-native-code-errors)), it may be slightly slower than `pool: 'threads'` in larger projects.

packages/vitest/src/defaults.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export { defaultBrowserPort } from './constants'
1212
export const defaultInclude: string[] = ['**/*.{test,spec}.?(c|m)[jt]s?(x)']
1313
export const defaultExclude: string[] = [
1414
'**/node_modules/**',
15-
'**/dist/**',
16-
'**/cypress/**',
17-
'**/.{idea,git,cache,output,temp}/**',
18-
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',
15+
'**/.git/**',
1916
]
2017
export const benchmarkConfigDefaults: Required<
2118
Omit<BenchmarkUserOptions, 'outputFile' | 'compare' | 'outputJson'>

packages/vitest/src/node/types/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export interface InlineConfig {
271271

272272
/**
273273
* Exclude globs for test files
274-
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
274+
* @default ['**\/node_modules/**', '**\/.git/**']
275275
*/
276276
exclude?: string[]
277277

test/cli/fixtures/dotted-files/.cache/projects/test/.cache/should-not-run.test.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)