-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeCoverageReport.ps1
24 lines (19 loc) · 1.02 KB
/
CodeCoverageReport.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
param (
[Parameter(Mandatory = $true)] [string] $reportFolder,
[Parameter(Mandatory = $true)] [string] $sourceFolder
)
try {
reportgenerator "-reports:$sourceFolder/**/coverage.cobertura.xml" "-targetdir:$reportFolder\codecoveragereport" "-reporttypes:HtmlInline_AzurePipelines;Cobertura";
write-host 'CoverageReport Published - ' $reportFolder\codecoveragereport;
}
catch [System.Management.Automation.CommandNotFoundException] {
write-host "report generator not present installing and re-attempting to generate report.";
dotnet tool install -g dotnet-reportgenerator-globaltool;
reportgenerator "-reports:$sourceFolder/**/coverage.cobertura.xml" "-targetdir:$reportFolder\codecoveragereport" "-reporttypes:HtmlInline_AzurePipelines;Cobertura";
write-host 'CoverageReport Published - ' $reportFolder\codecoveragereport;
}
catch {
write-host "Caught an exception:";
write-host "Exception Type: $($_.Exception.GetType().FullName)";
write-host "Exception Message: $($_.Exception.Message)";
}