From 38881685714103c7ce0565252775e25d1643e51e Mon Sep 17 00:00:00 2001 From: James Wampler Date: Sun, 5 Jul 2026 13:11:25 -0700 Subject: [PATCH] Exclude Migrations namespace from dotnet code coverage EF migrations are generated scaffolding with no meaningful logic to test; counting them against the coverage target only dilutes the signal. --- scripts/ci/test.sh | 10 +++++++++- .../api/MicCheck.Api.Tests.Unit/coverlet.runsettings | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/api/MicCheck.Api.Tests.Unit/coverlet.runsettings diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index 67e026e..6f67d98 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -8,9 +8,17 @@ cd "$CI_ROOT" ensure_dotnet +# --results-directory doesn't clear prior runs - it adds a new GUID folder +# alongside old ones every time. On a runner that reuses its workspace +# (self-hosted, unlike GitHub's ephemeral ones), stale coverage from past +# runs would otherwise get merged in by coverage.sh and silently skew the +# combined percentage. +rm -rf "$CI_ROOT/coverage/dotnet" + log "Running MicCheck.Api.Tests.Unit" dotnet test tests/api/MicCheck.Api.Tests.Unit/MicCheck.Api.Tests.Unit.csproj -c Release --logger trx \ - --collect:"XPlat Code Coverage" --results-directory "$CI_ROOT/coverage/dotnet" + --collect:"XPlat Code Coverage" --results-directory "$CI_ROOT/coverage/dotnet" \ + --settings tests/api/MicCheck.Api.Tests.Unit/coverlet.runsettings log "Running admin Jest tests" npm --prefix src/admin test -- --coverage --coverageReporters=lcov --coverageReporters=text-summary diff --git a/tests/api/MicCheck.Api.Tests.Unit/coverlet.runsettings b/tests/api/MicCheck.Api.Tests.Unit/coverlet.runsettings new file mode 100644 index 0000000..da026bc --- /dev/null +++ b/tests/api/MicCheck.Api.Tests.Unit/coverlet.runsettings @@ -0,0 +1,12 @@ + + + + + + + [MicCheck.Api]MicCheck.Api.Migrations.* + + + + +