chore: update test script to allow running from anywhere and also clean up test results on each run

This commit is contained in:
Stevan Freeborn committed 2026-08-28 09:13:59 -05:00
1 parent 7ad14767b6
commit e6891a72ea
1 file changed
+20 -6
+20 -6
View File
@@ -1,12 +1,22 @@
Write-Host "Starting test execution..." -ForegroundColor Magenta
Write-Host ""
$RepoRoot = Resolve-Path (Join-Path -Path $PSScriptRoot -ChildPath "..")
dotnet test
Push-Location -Path $RepoRoot
try {
Write-Host "Starting test execution..." -ForegroundColor Magenta
Write-Host ""
$TestExitCode = $LASTEXITCODE
$TestResultsPath = Join-Path -Path $RepoRoot -ChildPath "TestResults"
if ($TestExitCode -eq 0) {
if (Test-Path $TestResultsPath) {
Remove-Item -Path $TestResultsPath -Recurse -Force
}
dotnet test
$TestExitCode = $LASTEXITCODE
if ($TestExitCode -eq 0) {
Write-Host ""
Write-Host "Tests passed. Generating code coverage HTML report..." -ForegroundColor Magenta
Write-Host ""
@@ -15,8 +25,12 @@ if ($TestExitCode -eq 0) {
Write-Host ""
Write-Host "SUCCESS: All tests passed and coverage report generated." -ForegroundColor Green
} else {
} else {
Write-Host "FAILURE: Tests failed with exit code $TestExitCode. Skipping coverage report generation." -ForegroundColor Red
}
}
finally {
Pop-Location
}
exit $TestExitCode