Skip to content

Commit

Permalink
fix: improve config's default exclude (#2188)
Browse files Browse the repository at this point in the history
* ignore configuration files by default

* add config exclude to the docs

* Update packages/vitest/src/defaults.ts

Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>

* add config to default coverage excludes

* add coverage exclude to docs

* exclude other config files and update docs

Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
Co-authored-by: Vladimir <sheremet.va@icloud.com>
  • Loading branch information
3 people committed Oct 27, 2022
1 parent 221ddfd commit 576d791
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/config/index.md
Expand Up @@ -81,7 +81,7 @@ Files to include in the test run, using glob pattern.
### exclude

- **Type:** `string[]`
- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**']`
- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*']`

Files to exclude from the test run, using glob pattern.

Expand Down Expand Up @@ -536,7 +536,7 @@ List of files included in coverage as glob patterns
##### exclude

- **Type:** `string[]`
- **Default:** `[]`
- **Default:** `['coverage/**', 'dist/**', 'packages/*/test{,s}/**', '**/*.d.ts', 'cypress/**', 'test{,s}/**', 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}', '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}', '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}', '**/__tests__/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}', '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}']`

List of files excluded from coverage as glob patterns.

Expand Down
5 changes: 2 additions & 3 deletions packages/vitest/src/defaults.ts
@@ -1,8 +1,7 @@
import type { BenchmarkUserOptions, ResolvedCoverageOptions, UserConfig } from './types'

export const defaultInclude = ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
export const defaultExclude = ['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**']

export const defaultExclude = ['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*']
export const benchmarkConfigDefaults: Required<Omit<BenchmarkUserOptions, 'outputFile'>> = {
include: ['**/*.{bench,benchmark}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
exclude: defaultExclude,
Expand All @@ -21,7 +20,7 @@ const defaultCoverageExcludes = [
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
]

Expand Down

0 comments on commit 576d791

Please sign in to comment.