-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test visibility] Add total code coverage measure to vitest (#4570)
- Loading branch information
1 parent
3e690eb
commit f53157a
Showing
5 changed files
with
110 additions
and
10 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
integration-tests/ci-visibility/vitest-tests/coverage-test.mjs
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,8 @@ | ||
import { describe, test, expect } from 'vitest' | ||
import { sum } from './sum' | ||
|
||
describe('code coverage', () => { | ||
test('passes', () => { | ||
expect(sum(1, 2)).to.equal(3) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
const config = { | ||
test: { | ||
include: [ | ||
process.env.TEST_DIR || 'ci-visibility/vitest-tests/test-visibility*' | ||
] | ||
} | ||
}) | ||
} | ||
|
||
if (process.env.COVERAGE_PROVIDER) { | ||
config.test.coverage = { | ||
provider: process.env.COVERAGE_PROVIDER || 'v8', | ||
include: ['ci-visibility/vitest-tests/**'], | ||
reporter: ['text-summary'] | ||
} | ||
} | ||
|
||
export default defineConfig(config) |
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