Skip to content

Commit 5da45db

Browse files
authored
fix(coverage): ignore *.cts files (#6189)
1 parent 9057614 commit 5da45db

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

docs/config/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ List of files included in coverage as glob patterns
11031103
#### coverage.extension
11041104

11051105
- **Type:** `string | string[]`
1106-
- **Default:** `['.js', '.cjs', '.mjs', '.ts', '.mts', '.cts', '.tsx', '.jsx', '.vue', '.svelte', '.marko']`
1106+
- **Default:** `['.js', '.cjs', '.mjs', '.ts', '.mts', '.tsx', '.jsx', '.vue', '.svelte', '.marko']`
11071107
- **Available for providers:** `'v8' | 'istanbul'`
11081108
- **CLI:** `--coverage.extension=<extension>`, `--coverage.extension=<extension1> --coverage.extension=<extension2>`
11091109

docs/guide/cli-table.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
| `--coverage.enabled` | Enables coverage collection. Can be overridden using the `--coverage` CLI option (default: `false`) |
2121
| `--coverage.include <pattern>` | Files included in coverage as glob patterns. May be specified more than once when using multiple patterns (default: `**`) |
2222
| `--coverage.exclude <pattern>` | Files to be excluded in coverage. May be specified more than once when using multiple extensions (default: Visit [`coverage.exclude`](https://vitest.dev/config/#coverage-exclude)) |
23-
| `--coverage.extension <extension>` | Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]`) |
23+
| `--coverage.extension <extension>` | Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".tsx", ".jsx", ".vue", ".svelte"]`) |
2424
| `--coverage.clean` | Clean coverage results before running tests (default: true) |
2525
| `--coverage.cleanOnRerun` | Clean coverage report on watch rerun (default: true) |
2626
| `--coverage.reportsDirectory <path>` | Directory to write coverage report to (default: ./coverage) |

packages/vitest/src/defaults.ts

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = {
6868
'.mjs',
6969
'.ts',
7070
'.mts',
71-
'.cts',
7271
'.tsx',
7372
'.jsx',
7473
'.vue',

packages/vitest/src/node/cli/cli-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export const cliOptionsConfig: VitestCLIOptions = {
203203
},
204204
extension: {
205205
description:
206-
'Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]`)',
206+
'Extension to be included in coverage. May be specified more than once when using multiple extensions (default: `[".js", ".cjs", ".mjs", ".ts", ".mts", ".tsx", ".jsx", ".vue", ".svelte"]`)',
207207
argument: '<extension>',
208208
array: true,
209209
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Vite does not transform `*.cts` files.
3+
* If this file is picked by Istanbul provider, it will make Babel crash on TS syntax.
4+
*/
5+
interface Props {
6+
name: string;
7+
}

0 commit comments

Comments
 (0)