Skip to content

Commit

Permalink
feat!: disable coverage.reportOnFailure by default (#3615)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Jul 11, 2023
1 parent 9608bf7 commit 0c6f624
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ Since Vitest 0.31.0, you can check your coverage report in Vitest UI: check [Vit
#### coverage.reportOnFailure

- **Type:** `boolean`
- **Default:** `true`
- **Default:** `false` (since Vitest `0.34.0`)
- **Available for providers:** `'c8' | 'v8' | 'istanbul'`
- **CLI:** `--coverage.reportOnFailure`, `--coverage.reportOnFailure=false`
- **Version:** Since Vitest 0.31.2
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = {
cleanOnRerun: true,
reportsDirectory: './coverage',
exclude: defaultCoverageExcludes,
reportOnFailure: true,
reportOnFailure: false,
reporter: [['text', {}], ['html', {}], ['clover', {}], ['json', {}]],
// default extensions used by c8, plus '.vue' and '.svelte'
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/types/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface BaseCoverageOptions {
/**
* Generate coverage report even when tests fail.
*
* @default true
* @default false
*/
reportOnFailure?: boolean
}
Expand Down
3 changes: 1 addition & 2 deletions test/fails/test/runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ it('should report coverage when "coverag.reportOnFailure: true" and tests fail',
expect(stdout).toMatch('Coverage report from istanbul')
})

it('should not report coverage when "coverag.reportOnFailure: false" and tests fail', async () => {
it('should not report coverage when "coverag.reportOnFailure" has default value and tests fail', async () => {
const { stdout } = await runVitest({
root,
coverage: {
enabled: true,
provider: 'istanbul',
reportOnFailure: false,
reporter: ['text'],
},
}, [files[0]])
Expand Down

0 comments on commit 0c6f624

Please sign in to comment.