Skip to content

Commit 6de4bfd

Browse files
author
vp
committed
Add .runsettings file for code coverage configuration and update tasks-coverage.ps1 to use it
1 parent da5f51c commit 6de4bfd

3 files changed

Lines changed: 86 additions & 290 deletions

File tree

.runsettings

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<DataCollectionRunSettings>
4+
<DataCollectors>
5+
<DataCollector friendlyName="Code Coverage">
6+
<Configuration>
7+
<CodeCoverage>
8+
<ExcludeByFile>
9+
<File>**/Program.cs</File>
10+
</ExcludeByFile>
11+
</CodeCoverage>
12+
</Configuration>
13+
</DataCollector>
14+
</DataCollectors>
15+
</DataCollectionRunSettings>
16+
</RunSettings>

.vscode/tasks-coverage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $runDir = Join-Path $fullResults "run_$timestamp"
1616
New-Item -ItemType Directory -Force -Path $runDir | Out-Null
1717
$logFile = Join-Path $runDir 'test.log'
1818
Write-Host 'Executing dotnet test with coverage...' -ForegroundColor Green
19-
& dotnet test $Solution --collect:"XPlat Code Coverage" --results-directory $runDir | Tee-Object -FilePath $logFile
19+
& dotnet test $Solution --collect:"XPlat Code Coverage" --results-directory $runDir --settings:.runsettings | Tee-Object -FilePath $logFile
2020
if($LASTEXITCODE -ne 0){ Write-Host 'dotnet test failed.' -ForegroundColor Red; exit 1 }
2121
# Find coverage files (cobertura or json)
2222
$coverageFiles = Get-ChildItem -Recurse -Path $runDir -Filter 'coverage.cobertura.xml'

0 commit comments

Comments
 (0)