#!/usr/bin/env bash # Runs Novelly.Api.Tests with coverage collection. No web test suite exists yet # (src/Novelly.Web/package.json has no "test" script) — nothing to run there. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" && source ./lib.sh cd "$CI_ROOT" ensure_dotnet # Coverlet doesn't clear prior output — 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 Novelly.Api.Tests" dotnet test tests/Novelly.Api.Tests/Novelly.Api.Tests.csproj -c Release --logger trx \ /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura \ /p:CoverletOutput="$CI_ROOT/coverage/dotnet/" \ /p:Exclude="[Novelly.ServiceDefaults]*" \ /p:ExcludeByFile="**/Data/Migrations/*.cs" log "test.sh complete"