1234567891011121314151617181920212223242526272829303132333435 |
- #!/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/
- $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%"
- }
- else {
-
- Write-Host "##vso[task.LogIssue type=error;]Unit tests failed."
- }
- Pop-Location
- exit $ExitCode
|