1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

Implement code coverage tool (#1390)

* Implement code coverage tool

* Switch to solution style of running tests

* Add shell version of coverage file

* Fix formatting in coverage.sh

* Add trailing newline to powershell
This commit is contained in:
Justin Baur
2021-06-21 13:22:47 -04:00
committed by GitHub
parent 658f79b80e
commit 59268790c9
8 changed files with 171 additions and 0 deletions

31
test/coverage.ps1 Normal file
View File

@ -0,0 +1,31 @@
param(
[string][Alias('c')]$Configuration = "Release",
[string][Alias('o')]$Output = "CoverageOutput",
[string][Alias('rt')]$ReportType = "lcov"
)
function Install-Tools {
dotnet tool restore
}
function Print-Environment {
dotnet --version
}
function Prepare-Output {
if (Test-Path -Path $Output) {
Remove-Item $Output -Recurse
}
}
function Run-Tests {
dotnet test $PSScriptRoot/bitwarden.tests.sln /p:CoverletOutputFormatter="cobertura" --collect:"XPlat Code Coverage" --results-directory:"$Output" -c $Configuration
dotnet tool run reportgenerator -reports:$Output/**/*.cobertura.xml -targetdir:$Output -reporttypes:"$ReportType"
}
Write-Host "Collecting Code Coverage"
Install-Tools
Print-Environment
Prepare-Output
Run-Tests