.NET
What is planned
Section titled “What is planned”When the built-in .NET runner ships, it will:
- Accept
lang: dotnetinnolapse.yaml. - Invoke
dotnet test --collect:"XPlat Code Coverage"automatically. - Parse the Cobertura XML report produced by Coverlet to extract line coverage.
- Respect the same
warn_threshold/fail_threshold/strict_modesettings as all other runners.
The expected nolapse.yaml when it is available:
lang: dotnetwarn_threshold: -1.0fail_threshold: -5.0strict_mode: falseWorkaround: custom runner (Coverlet)
Section titled “Workaround: custom runner (Coverlet)”Until the built-in runner ships you can invoke dotnet test with Coverlet and parse the resulting JSON summary.
1. Add Coverlet to your test project
Section titled “1. Add Coverlet to your test project”dotnet add package coverlet.collectorOr for MSBuild integration:
dotnet add package coverlet.msbuild2. Write a custom runner script
Section titled “2. Write a custom runner script”Create nolapse-runner.sh at the repo root:
#!/usr/bin/env bashset -euo pipefail
REPO_PATH="${1:-.}"cd "$REPO_PATH"
# Run tests and produce a JSON summary via coverletdotnet test --collect:"XPlat Code Coverage" \ -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=json \ DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.OutputFormat=json
# Find the most recently written coverage.jsonCOVERAGE_FILE=$(find . -name "coverage.json" -newer nolapse.yaml 2>/dev/null | head -1)
if [ -z "$COVERAGE_FILE" ]; then echo "nolapse-runner: coverage.json not found" >&2 exit 1fi
PCT=$(python3 -c "import json, sysdata = json.load(open('$COVERAGE_FILE'))lines_covered = sum(v.get('Summary', {}).get('LinesCovered', 0) for v in data.values())lines_total = sum(v.get('Summary', {}).get('LinesTotal', 0) for v in data.values())print(f'{(lines_covered / lines_total * 100):.1f}' if lines_total else '0.0')")
echo "nolapse-coverage: ${PCT}"Make it executable:
chmod +x nolapse-runner.sh3. Configure nolapse
Section titled “3. Configure nolapse”lang: customwarn_threshold: -1.0fail_threshold: -5.0Run nolapse:
NOLAPSE_RUNNER_PATH=./nolapse-runner.sh nolapse run --repo .See Custom Runner for the full runner contract.
Track the roadmap
Section titled “Track the roadmap”Watch the nolapse changelog and the .NET runner issue for updates.