Skip to content

Commit

Permalink
feat: add mts, cts files to coverage (#2492)
Browse files Browse the repository at this point in the history
* feat: mts coverage

* test: fix

* fix: snapslot

* docs: coverage

* fix: snapslot

* chore: update

Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>

* chore: reset

Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>
  • Loading branch information
poyoho and AriPerkkio committed Dec 13, 2022
1 parent affb9ea commit 799f9a1
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
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'
import { implicitElse } from '../src/implicitElse'
import { useImportEnv } from '../src/importEnv'

Expand Down

0 comments on commit 799f9a1

Please sign in to comment.