mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Wire up code coverage (#3618)
This commit is contained in:
@ -1,31 +0,0 @@
|
||||
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
|
@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set defaults if no values supplied
|
||||
CONFIGURATION="Release"
|
||||
OUTPUT="CoverageOutput"
|
||||
REPORT_TYPE="lcov"
|
||||
|
||||
|
||||
# Read in arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-c|--configuration)
|
||||
|
||||
CONFIGURATION="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-o|--output)
|
||||
OUTPUT="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-rt|--reportType)
|
||||
REPORT_TYPE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "CONFIGURATION = ${CONFIGURATION}"
|
||||
echo "OUTPUT = ${OUTPUT}"
|
||||
echo "REPORT_TYPE = ${REPORT_TYPE}"
|
||||
|
||||
echo "Collectiong Code Coverage"
|
||||
# Install tools
|
||||
dotnet tool restore
|
||||
# Print Environment
|
||||
dotnet --version
|
||||
|
||||
if [[ -d $OUTPUT ]]; then
|
||||
echo "Cleaning output location"
|
||||
rm -rf $OUTPUT
|
||||
fi
|
||||
|
||||
dotnet test "./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 -reporttype:"$REPORT_TYPE"
|
Reference in New Issue
Block a user