#!/usr/bin/env pwsh # Script to run tests with code coverage Write-Host "Running tests with code coverage..." -ForegroundColor Green # Run tests with coverlet dotnet test --collect:"XPlat Code Coverage" --results-directory:./TestResults Write-Host "`nTest execution completed!" -ForegroundColor Green Write-Host "Coverage results are in ./TestResults folder" -ForegroundColor Yellow # Find the most recent coverage file $coverageFiles = Get-ChildItem -Path "./TestResults" -Filter "coverage.cobertura.xml" -Recurse | Sort-Object LastWriteTime -Descending if ($coverageFiles.Count -gt 0) { Write-Host "`nCoverage file location:" -ForegroundColor Cyan Write-Host $coverageFiles[0].FullName -ForegroundColor White }