From d524a2b664ae0d5a98cd0cd5e61703c5835e5697 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 1 Jul 2026 23:47:25 +0200 Subject: [PATCH] Also fail on Pester block/container failures, not just failed tests In Pester 5 a run has three independent failure counts. Gating only on FailedCount misses FailedBlocksCount (BeforeAll/AfterAll) and FailedContainersCount (files that fail to discover/load), so a failing BeforeAll or an unloadable test file passes the build green. This adds those counts to the gate. Generated with AI (GitHub Copilot CLI). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- psakeFile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psakeFile.ps1 b/psakeFile.ps1 index a0fa013..b886d55 100644 --- a/psakeFile.ps1 +++ b/psakeFile.ps1 @@ -51,7 +51,7 @@ task Pester -depends Build { $testResults = Invoke-Pester -Configuration $pesterConfiguration - if ($testResults.FailedCount -gt 0) { + if (($testResults.FailedCount + $testResults.FailedBlocksCount + $testResults.FailedContainersCount) -gt 0) { $testResults | Format-List Write-Error -Message 'One or more Pester tests failed. Build cannot continue!' }