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: coverage threshold #783

Merged
merged 1 commit into from Feb 18, 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
12 changes: 12 additions & 0 deletions packages/vitest/src/integrations/coverage.ts
Expand Up @@ -97,4 +97,16 @@ export async function reportCoverage(ctx: Vitest) {
}

await report.run()

if (ctx.config.coverage.enabled) {
if (ctx.config.coverage['100']) {
ctx.config.coverage.lines = 100
ctx.config.coverage.functions = 100
ctx.config.coverage.branches = 100
ctx.config.coverage.statements = 100
}

const { checkCoverages } = require('c8/lib/commands/check-coverage')
await checkCoverages(ctx.config.coverage, report)
}
}
5 changes: 5 additions & 0 deletions packages/vitest/src/types/coverage.ts
Expand Up @@ -63,6 +63,11 @@ export interface C8Options {

all?: boolean

100?: boolean
lines?: number
functions?: number
branches?: number
statements?: number
}

export interface ResolvedC8Options extends Required<C8Options> {
Expand Down