-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!:
--merge-reports
to support coverage
- Loading branch information
1 parent
a4ec583
commit dad15a1
Showing
16 changed files
with
191 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,3 +72,7 @@ export default defineConfig({ | |
}) | ||
``` | ||
::: | ||
|
||
## Sharding | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,6 @@ it(createVitest, async () => { | |
}, | ||
], | ||
[], | ||
undefined, | ||
]) | ||
}) |
27 changes: 27 additions & 0 deletions
27
test/coverage-test/coverage-report-tests/merge-reports.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { expect, test } from 'vitest' | ||
import libCoverage from 'istanbul-lib-coverage' | ||
|
||
import { readCoverageJson } from '../coverage-report-tests/utils' | ||
|
||
test('reports are merged', async () => { | ||
const json = await readCoverageJson('./coverage/coverage-final.json') | ||
const coverageMap = libCoverage.createCoverageMap(json as any) | ||
const files = coverageMap.files() | ||
|
||
// Two files were covered: 2/3 cases covered utils, 1/3 covered importEnv | ||
expect(files).toMatchInlineSnapshot(` | ||
[ | ||
"<process-cwd>/src/importEnv.ts", | ||
"<process-cwd>/src/utils.ts", | ||
] | ||
`) | ||
|
||
const fileCoverage = coverageMap.fileCoverageFor('<process-cwd>/src/utils.ts') | ||
const lines = fileCoverage.getLineCoverage() | ||
|
||
// add() should be covered by one test file | ||
expect(lines[2]).toBe(1) | ||
|
||
// multiply() should be covered by two test files | ||
expect(lines[6]).toBe(2) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test } from 'vitest' | ||
import { add } from '../src/utils' | ||
|
||
test('cover add', () => { | ||
add(1, 2) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test } from 'vitest' | ||
import { multiply } from '../src/utils' | ||
|
||
test('cover multiply', () => { | ||
multiply(1, 2) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { test } from 'vitest' | ||
import { multiply } from '../src/utils' | ||
import { useImportEnv } from '../src/importEnv' | ||
|
||
test('cover multiply again', () => { | ||
multiply(1, 2) | ||
}) | ||
|
||
test('also cover another file', () => { | ||
useImportEnv() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.