Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mts coverage #2492

Merged
merged 8 commits into from Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/config/index.md
Expand Up @@ -534,7 +534,7 @@ List of files included in coverage as glob patterns
#### extension

- **Type:** `string | string[]`
- **Default:** `['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte']`
- **Default:** `['.js', '.cjs', '.mjs', '.ts', '.mts', '.cts', '.tsx', '.jsx', '.vue', '.svelte']`
- **Available for providers:** `'c8' | 'istanbul'`

#### exclude
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/defaults.ts
Expand Up @@ -36,7 +36,7 @@ const coverageConfigDefaults = {
allowExternal: false,
// default extensions used by c8, plus '.vue' and '.svelte'
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
extension: ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte'],
extension: ['.js', '.cjs', '.mjs', '.ts', '.mts', '.cts', '.tsx', '.jsx', '.vue', '.svelte'],
} as ResolvedCoverageOptions

export const fakeTimersDefaults = {
Expand Down
Expand Up @@ -1426,7 +1426,7 @@ exports[`c8 json report 1`] = `
},
},
},
"<process-cwd>/src/index.ts": {
"<process-cwd>/src/index.mts": {
"all": false,
"b": {
"0": [
Expand Down Expand Up @@ -1544,7 +1544,7 @@ exports[`c8 json report 1`] = `
"name": "get",
},
},
"path": "<process-cwd>/src/index.ts",
"path": "<process-cwd>/src/index.mts",
"s": {
"0": 1,
"1": 1,
Expand Down
Expand Up @@ -580,7 +580,7 @@ exports[`istanbul json report 1`] = `
},
},
},
"<process-cwd>/src/index.ts": {
"<process-cwd>/src/index.mts": {
"b": {},
"branchMap": {},
"f": {
Expand Down Expand Up @@ -611,7 +611,7 @@ exports[`istanbul json report 1`] = `
"name": "pythagoras",
},
},
"path": "<process-cwd>/src/index.ts",
"path": "<process-cwd>/src/index.mts",
"s": {
"0": 1,
},
Expand Down
Expand Up @@ -11,7 +11,7 @@ test('html report', async () => {
const files = fs.readdirSync(coveragePath)

expect(files).toContain('index.html')
expect(files).toContain('index.ts.html')
expect(files).toContain('index.mts.html')
expect(files).toContain('Hello.vue.html')
})

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/coverage-test/test/coverage.test.ts
@@ -1,5 +1,5 @@
import { expect, test } from 'vitest'
import { pythagoras } from '../src'
import { pythagoras } from '../src/index.mjs'
poyoho marked this conversation as resolved.
Show resolved Hide resolved
import { implicitElse } from '../src/implicitElse'
import { useImportEnv } from '../src/importEnv'

Expand Down