Skip to content

Commit

Permalink
feat: coverage threshold (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtchnm committed Feb 18, 2022
1 parent 15ea3a3 commit b068b44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit b068b44

Please sign in to comment.