12345678910111213141516171819202122232425262728293031 |
- #!/usr/bin/env pwsh
- <
- .SYNOPSIS
- Runs unit tests. Outputs test results and code coverage report.
- $scriptDir = Split-Path $PSCommandPath -Parent
- $projectDir = (Get-Item $scriptDir).Parent
- Push-Location $projectDir
- $ExitCode = 0
- pytest coderedcms/ --ds=coderedcms.tests.settings --junitxml=junit/test-results.xml --cov=coderedcms --cov-report=xml --cov-report=html
- $ExitCode = $LastExitCode
- if ($ExitCode -eq 0) {
- [xml]$BranchXML = Get-Content coverage.xml
- $LineRate = [math]::Round([decimal]$BranchXML.coverage.'line-rate' * 100, 2)
- Write-Output "All unit tests passed! 🎉"
- Write-Output "Code coverage: $LineRate%"
- }
- Pop-Location
- exit $ExitCode
|