-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage.ps1
More file actions
20 lines (14 loc) · 889 Bytes
/
coverage.ps1
File metadata and controls
20 lines (14 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
dotnet build -c Release
dotnet test --project tests/UnitTests -c Release --no-build --results-directory test-results `
--coverage --coverage-output-format cobertura --coverage-output coverage1.cobertura.xml
dotnet test --project tests/IntegrationTests -c Release --no-build --results-directory test-results `
--coverage --coverage-output-format cobertura --coverage-output coverage2.cobertura.xml
$coverageFiles = Get-ChildItem -Path "test-results" -Recurse -Filter "*cobertura.xml"
if ($coverageFiles) {
$reportFiles = ($coverageFiles | ForEach-Object { $_.FullName }) -join ";"
dotnet tool run reportgenerator -reports:$reportFiles -targetdir:coverage-report
Start-Process "coverage-report/index.html"
} else {
Write-Host "Coverage reports not found."
}
Get-ChildItem -Path "test-results" -Recurse | ForEach-Object { Remove-Item -Recurse -Force -Path $_.FullName }