LCOV
lcovVitest, Jest, c8, Istanbul, Rust (llvm-cov, tarpaulin), Flutter/Dart, C/C++, Ruby, PHP
Tracks lines, branches, functions, and PR diff lines.
Test Verdict auto-detects coverage reports across 6 formats, computes overall and PR diff coverage, posts a sticky pull request summary, and enforces merge gates in GitHub Actions, Azure Pipelines, or any CI via CLI.
Pass one or more report globs (even across mixed formats in the same monorepo). Test Verdict normalizes paths against your repository tree and merges overlapping line hits automatically.
Vitest, Jest, c8, Istanbul, Rust (llvm-cov, tarpaulin), Flutter/Dart, C/C++, Ruby, PHP
Tracks lines, branches, functions, and PR diff lines.
Python (pytest-cov, coverage.py), .NET (coverlet), Go (gocover-cobertura)
Tracks lines, branches, and PR diff line + branch coverage.
Java, Kotlin, Scala, Groovy (Gradle and Maven multi-module builds)
Resolves relative package paths like com/acme/App.java against git tracked files.
coverage-final.json and coverage-summary.json
Full line, branch, function, and PR diff metrics from coverage-final.json.
Go native go test -coverprofile=coverage.out ./...
Strips module import prefixes; safely warns and skips branch/function gates.
.NET (OpenCover, AltCover)
Normalizes Windows separators and evaluates lines, branches, and methods.
Choose your CI platform or run the standalone CLI locally. For production repos, see the hardened two-job configuration below.
name: Coverage Gate
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: npm ci && npm test -- --coverage
- if: ${{ !cancelled() && hashFiles('coverage/lcov.info') != '' }}
uses: steveswinsburg/test-verdict@v0
with:
files: coverage/lcov.info
min-line: 80
min-diff-line: 90
trigger:
- main
pr:
- main
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 0
- script: npm ci && npx vitest run --coverage --coverage.reporter=lcov
displayName: Run tests with coverage
- task: TestVerdict@0
inputs:
files: coverage/lcov.info
minLine: '80'
minDiffLine: '90'
Grant Contribute to pull requests: Allow to your Azure DevOps Build Service account under Project Settings -> Repositories -> Security so the task can post PR comment threads.
npx test-verdict \
--files coverage/lcov.info \
--files "**/jacocoTestReport.xml" \
--min-line 80 \
--min-diff-line 90 \
--diff-base origin/main \
--markdown
title: Monorepo Coverage
exclude:
- "**/*.generated.*"
- "**/__tests__/**"
thresholds:
min-line: 80
min-diff-line: 85
groups:
- name: backend-java
files:
- "services/api/**/jacocoTestReport.xml"
thresholds:
min-line: 85
min-branch: 75
- name: frontend-web
files:
- "apps/web/coverage/lcov.info"
thresholds:
min-line: 80
Install the hosted Test Verdict GitHub App once on your repositories or organization, then swap pull-requests: write for id-token: write. No private keys, repository secrets, or custom app-url inputs are required.
Choose the repositories or organization where you want Test Verdict to post. The Test Verdict Bot app requests only Pull requests: Read and write (plus GitHub's mandatory read-only Metadata) and never asks for write access to source code.
Grant id-token: write instead of pull-requests: write. Everything else stays identical, and on untrusted fork PRs or repos without the app installed, Test Verdict degrades cleanly to the Job Step Summary and exit-code gating.
name: Coverage Gate
on:
pull_request:
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: npm ci && npm test -- --coverage
- if: ${{ !cancelled() && hashFiles('coverage/lcov.info') != '' }}
uses: steveswinsburg/test-verdict@v0
with:
files: coverage/lcov.info
min-line: 80
min-diff-line: 90
How the token flow works: the Action requests a signed GitHub Actions OIDC JWT (core.getIDToken), exchanges it via the Cloudflare Worker broker (https://test-verdict-app.steve-swinsburg.workers.dev) for a single-repo pull_requests: write token, masks it with core.setSecret, and immediately revokes it (DELETE /installation/token) when the step finishes. In a hardened two-job workflow, only the verdict job needs id-token: write while the test job keeps contents: read.
Pick your platform, coverage ecosystem, thresholds, and hardening options to generate a ready-to-paste snippet.
Complete reference across the GitHub Action, Azure Pipelines task, standalone CLI, and optional .test-verdict.yml file.
| Input | Default | Description |
|---|---|---|
files | - | Newline or comma-separated coverage report globs. |
format | auto | Report format override: auto, lcov, cobertura, jacoco, istanbul, gocover, or opencover. |
config | .test-verdict.yml | Path to optional YAML config file, or none / false to disable config loading. |
include | - | Source path inclusion globs. Changed files matching include but absent from reports count as 0% diff coverage. |
exclude | - | Newline or comma-separated source path exclusion globs. |
report-id | default | Unique identifier for sticky PR comments when running multiple steps or suites. |
title | Test Verdict | Heading shown at the top of PR comments and Job Step Summaries. |
min-line | - | Minimum overall line coverage percentage (0-100). |
min-branch | - | Minimum overall branch coverage percentage (0-100). |
min-function | - | Minimum overall function coverage percentage (0-100). |
min-diff-line | - | Minimum PR diff (changed lines) coverage percentage (0-100). |
min-diff-branch | - | Minimum PR diff branch coverage percentage (0-100). |
enforce | true | Fail the check when configured coverage thresholds are breached. |
fail-on-empty | true | Fail when no report files match or parsed reports contain no measured source files. |
comment | true | Post or update a sticky PR comment with coverage results. |
step-summary | true | Write the full coverage breakdown to the GitHub Job Step Summary. |
github-token | ${{ github.token }} | Token used to read PR changed lines and post PR comments. |
app-url | https://test-verdict-app.steve-swinsburg.workers.dev | HTTPS URL of the Test Verdict GitHub App OIDC token broker (Cloudflare Worker). |
use-app | auto | Use GitHub App OIDC token exchange when app-url is set: auto, true, or false. |
working-directory | . | Working directory containing the repository and coverage reports. |
| Output | Description |
|---|---|
line-coverage | Overall line coverage percentage, or empty if unavailable. |
branch-coverage | Overall branch coverage percentage, or empty if unavailable. |
function-coverage | Overall function coverage percentage, or empty if unavailable. |
diff-coverage | PR diff line coverage percentage, or empty if unavailable. |
passed | "true" or "false". |
summary-json | JSON payload summarizing overall metrics, groups, violations, and warnings. |
| Input | Default | Description |
|---|---|---|
files | - | Newline or comma-separated coverage report globs. |
format | auto | Report format override: auto, lcov, cobertura, jacoco, istanbul, gocover, or opencover. |
config | .test-verdict.yml | Path to optional YAML config file (or none / false). |
exclude | - | Newline or comma-separated source path exclusion globs. |
minLine | - | Minimum overall line coverage % (0-100). |
minBranch | - | Minimum overall branch coverage % (0-100). |
minFunction | - | Minimum overall function coverage % (0-100). |
minDiffLine | - | Minimum PR changed-lines coverage % (0-100). |
minDiffBranch | - | Minimum PR changed-lines branch coverage % (0-100). |
diffBase | - | Optional git ref to diff against (defaults to System.PullRequest.TargetBranch). |
enforce | true | Fail the task when thresholds are breached. |
failOnEmpty | true | Fail if no coverage files match files. |
comment | true | Post or update sticky PR comment thread (active on fail, closed on pass). |
summary | true | Upload full coverage breakdown to the Build Summary tab. |
title | Test Verdict | Heading for PR comments and Build Summaries. |
reportId | default | Identifier for sticky PR comments across multiple steps. |
token | - | Optional PAT/OAuth token override (defaults to SystemVssConnection). |
workingDirectory | $(Build.SourcesDirectory) | Working directory containing the repository and coverage reports. |
| Output Variable | Description |
|---|---|
lineCoverage | Overall line coverage percentage (empty if unavailable). |
branchCoverage | Overall branch coverage percentage (empty if unavailable). |
functionCoverage | Overall function coverage percentage (empty if unavailable). |
diffCoverage | PR diff line coverage percentage (empty if unavailable). |
passed | "true" or "false". |
summaryJson | Escaped JSON summary payload. |
| Option | Default | Description |
|---|---|---|
-f, --files <glob> | - | Coverage report glob pattern (repeatable). |
--format <fmt> | auto | auto, lcov, cobertura, jacoco, istanbul, gocover, or opencover. |
-c, --config <path> | .test-verdict.yml | Path to YAML config, or none / false to disable. |
--no-config | false | Disable auto-loading .test-verdict.yml. |
--include <glob> | - | Source glob to include (repeatable; unmeasured diff files count as 0%). |
-e, --exclude <glob> | - | Source glob to exclude (repeatable). |
--report-id <id> | default | Sticky comment report ID included in Markdown output. |
--title <text> | Test Verdict | Report title. |
--min-line <pct> | - | Minimum overall line coverage % (0-100). |
--min-branch <pct> | - | Minimum overall branch coverage % (0-100). |
--min-function <pct> | - | Minimum overall function coverage % (0-100). |
--min-diff-line <pct> | - | Minimum PR/git diff line coverage % (0-100). |
--min-diff-branch <pct> | - | Minimum PR/git diff branch coverage % (0-100). |
--diff-base <ref> | - | Git ref to diff against (for example origin/main or HEAD~1). |
--working-dir <dir> | . | Working directory. |
--enforce / --no-enforce | true | Exit non-zero on threshold breach (use --no-enforce to warn only). |
--fail-on-empty / --no-fail-on-empty | true | Fail when no reports match or contain no measured files. |
--markdown / --json | text | Print full Markdown report or machine-readable JSON summary to stdout. |
-h, --help / -v, --version | - | Show CLI help or installed version. |
| Key | Description |
|---|---|
title | Report heading for PR comments and summaries (default: Test Verdict). |
report-id / reportId | Sticky comment identifier (default: default). |
files | Glob string or array of globs when not using named groups. |
format | Global format override (auto, lcov, cobertura, jacoco, istanbul, gocover, or opencover). |
include / exclude | Source path globs applied globally (group exclude values append to global exclude). |
thresholds | Object with min-line, min-branch, min-function, min-diff-line, and min-diff-branch (camelCase also accepted). |
enforce / fail-on-empty | Booleans controlling whether threshold breaches or empty reports fail the run. |
groups | Array of suite objects (name, files, optional format, include, exclude, thresholds). Note: caller thresholds passed via workflow inputs act as a strict floor so PR edits cannot weaken org gates. |
Avoid granting pull-requests: write to the same job that runs npm ci, yarn install, or unit tests. Run tests in a job with permissions: contents: read and persist-credentials: false on actions/checkout, upload coverage/lcov.info as an artifact, and evaluate Test Verdict in a second job that alone holds pull-requests: write.
LCOV, Istanbul, and Cobertura work in the publish job without checking out the repository. For JaCoCo XML reports, add actions/checkout with persist-credentials: false in the publish job so relative package paths resolve against tracked files.
In high-security or private repositories, pin steveswinsburg/test-verdict@<full-commit-sha> instead of a mutable major tag.
Pass config: none in your workflow when you want to prevent a pull request branch from introducing a .test-verdict.yml that excludes files or alters settings. Even when an explicit config file is used, workflow-level thresholds act as a strict floor.
When running Test Verdict unconditionally with if: ${{ !cancelled() }}, a compile error or crashed test run that never produces coverage/lcov.info triggers a second red step. Use if: ${{ !cancelled() && hashFiles('coverage/lcov.info') != '' }} so Test Verdict only runs when a report exists.
If tests read source files using Vite's import.meta.glob(..., { query: '?raw' }), Vitest/V8 instruments untouched multi-line files as single-line modules (1/1 covered), artificially inflating coverage. Read source files with node:fs instead. Test Verdict also emits a SUSPICIOUS_SINGLE_LINE_COVERAGE warning if it detects multi-line files on disk reporting 1/1 covered.
Also pin @vitest/coverage-v8 to the exact same version as vitest, and add coverage/ to both .gitignore and ESLint ignores.
By default, comments posted with GITHUB_TOKEN appear under github-actions Bot:
To post as test-verdict-bot with zero stored secrets, install the hosted Test Verdict GitHub App on your repository and grant id-token: write in your workflow. You can also self-host the Cloudflare Worker token broker from worker/README.md, or mint tokens manually with actions/create-github-app-token as shown in CUSTOM_BOT.md.