Skip to content

Commit bfe8ad9

Browse files
authoredApr 30, 2024··
fix(coverage): exclude *.test-d.* by default (#5634)
1 parent 7d57c11 commit bfe8ad9

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed
 

‎docs/config/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ List of files included in coverage as glob patterns
11021102
'cypress/**',
11031103
'test?(s)/**',
11041104
'test?(-*).?(c|m)[jt]s?(x)',
1105-
'**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)',
1105+
'**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)',
11061106
'**/__tests__/**',
11071107
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
11081108
'**/vitest.{workspace,projects}.[jt]s?(on)',

‎packages/vitest/src/defaults.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const defaultCoverageExcludes = [
2323
'cypress/**',
2424
'test?(s)/**',
2525
'test?(-*).?(c|m)[jt]s?(x)',
26-
'**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)',
26+
'**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)',
2727
'**/__tests__/**',
2828
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
2929
'**/vitest.{workspace,projects}.[jt]s?(on)',

‎packages/vitest/src/types/coverage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export interface BaseCoverageOptions {
121121
/**
122122
* List of files excluded from coverage as glob patterns
123123
*
124-
* @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}.?(c|m)[jt]s?(x)', '**\/__tests__/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', '**\/vitest.{workspace,projects}.[jt]s?(on)', '**\/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}']
124+
* @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)', '**\/__tests__/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', '**\/vitest.{workspace,projects}.[jt]s?(on)', '**\/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}']
125125
*/
126126
exclude?: string[]
127127

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This file should be excluded from coverage report
2+
3+
export function uncoveredFile() {
4+
return 0
5+
}

0 commit comments

Comments
 (0)
Please sign in to comment.