dotnet-covdiff 0.1.0

dotnet tool install --global dotnet-covdiff --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-covdiff --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-covdiff&version=0.1.0
                    
nuke :add-package dotnet-covdiff --version 0.1.0
                    

dotnet-covdiff

PR-diff code coverage for .NET, in a dotnet tool. Tells reviewers if the lines actually changed in a pull request got tested. Runs in your existing GitHub Actions workflow, posts a markdown comment, fails the build if coverage drops.

✅ PR coverage: 28/30 changed lines covered (93.3%)

| File                    | Changed | Covered |    %    |
|-------------------------|--------:|--------:|--------:|
| `Auth/UserService.cs`   |      12 |      12 |  100% ✅ |
| `Billing/Invoice.cs`    |      18 |      16 |  88.9% 🟡 |

Total project line coverage: 78.4%

Install

dotnet tool install -g dotnet-covdiff

Use

Pipe coverlet's Cobertura output and a git base ref:

dotnet test --collect:"XPlat Code Coverage" --results-directory ./cov
dotnet-covdiff --coverage "cov/**/coverage.cobertura.xml" --base-ref origin/main

In GitHub Actions:

- uses: samdanae/dotnet-covdiff@v1
  with:
    coverage: '**/coverage.cobertura.xml'
    min: 80   # fail PR if changed-line coverage drops below 80%

CLI

--coverage <glob>      Glob for Cobertura XML files (repeatable). Required.
--base-ref  <ref>      Git ref to diff against. Default: origin/$GITHUB_BASE_REF, else origin/main.
--repo-root <path>     Repo root. Default: `git rev-parse --show-toplevel`.
--min       <pct>      Fail (exit 2) if PR-diff coverage is below this percent.
--output    <file>     Write markdown here. Default: stdout.
--post                 Post / replace a PR comment via `gh` (needs GH_TOKEN + PR context).

Why?

Lots of tools report total coverage. Covdiff reports PR-diff coverage, to answer: "did your changes get tested?".

License

MIT.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.1.0 169 6/25/2026