Skip to content

Commit

Permalink
fix(coverage): ignore *.cts files (#6189)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Jul 22, 2024
1 parent 9057614 commit 5da45db
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ List of files included in coverage as glob patterns
#### coverage.extension

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

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/cli-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| `--coverage.enabled` | Enables coverage collection. Can be overridden using the `--coverage` CLI option (default: `false`) |
| `--coverage.include <pattern>` | Files included in coverage as glob patterns. May be specified more than once when using multiple patterns (default: `**`) |
| `--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)) |
| `--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"]`) |
| `--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"]`) |
| `--coverage.clean` | Clean coverage results before running tests (default: true) |
| `--coverage.cleanOnRerun` | Clean coverage report on watch rerun (default: true) |
| `--coverage.reportsDirectory <path>` | Directory to write coverage report to (default: ./coverage) |
Expand Down
1 change: 0 additions & 1 deletion packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = {
'.mjs',
'.ts',
'.mts',
'.cts',
'.tsx',
'.jsx',
'.vue',
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/cli/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export const cliOptionsConfig: VitestCLIOptions = {
},
extension: {
description:
'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"]`)',
'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"]`)',
argument: '<extension>',
array: true,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Vite does not transform `*.cts` files.
* If this file is picked by Istanbul provider, it will make Babel crash on TS syntax.
*/
interface Props {
name: string;
}

0 comments on commit 5da45db

Please sign in to comment.