-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
RunCodeCoverage.ps1
23 lines (13 loc) · 1.03 KB
/
RunCodeCoverage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ErrorActionPreference = "Stop"
Write-Output 'Cleaning up old results'
Remove-Item -Path '.\TestCoverageResults\*' -Recurse -Force
Write-Output 'This folder is here to receive code coverage results. Ignore this file.' > .\TestCoverageResults\README.txt
Write-Output 'Running Code Coverage'
dotnet test --collect "XPlat Code Coverage" -r .\TestCoverageResults -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.SingleHit=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DoesNotReturnAttribute=DoesNotReturnAttribute
$CoverageFile = Get-ChildItem -Path ".\TestCoverageResults\" -r -Filter *.xml
Write-Output 'Coverage Complete, output: ' + $CoverageFile.FullName
dotnet .\ReportGenerator\ReportGenerator.dll -reports:$CoverageFile.FullName -targetdir:.\TestCoverageResults\
Write-Output 'Report generated'
if ($param1=$args[0] -ne 'silent') {
Start-Process -Wait -FilePath '.\TestCoverageResults\index.htm'
}