From 3d6b5d2ca290b1de66bf16a0261f8b37c348ab56 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 1 Jul 2026 23:48:14 +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> --- ConfluencePS.build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ConfluencePS.build.ps1 b/ConfluencePS.build.ps1 index 44cd50f..6e38603 100644 --- a/ConfluencePS.build.ps1 +++ b/ConfluencePS.build.ps1 @@ -128,7 +128,7 @@ Task Lint { } } $styleResults = Invoke-Pester -Configuration $styleConfig - Assert-True ($styleResults.FailedCount -eq 0) "$($styleResults.FailedCount) style test(s) failed." + Assert-True (($styleResults.FailedCount + $styleResults.FailedBlocksCount + $styleResults.FailedContainersCount) -eq 0) "$($styleResults.FailedCount) style test(s) failed." $pssaConfig = New-PesterConfiguration -Hashtable @{ Run = @{ @@ -140,7 +140,7 @@ Task Lint { } } $pssaResults = Invoke-Pester -Configuration $pssaConfig - Assert-True ($pssaResults.FailedCount -eq 0) "$($pssaResults.FailedCount) analyzer test(s) failed." + Assert-True (($pssaResults.FailedCount + $pssaResults.FailedBlocksCount + $pssaResults.FailedContainersCount) -eq 0) "$($pssaResults.FailedCount) analyzer test(s) failed." } Task Clean { @@ -499,7 +499,7 @@ Task Test { $pesterConfig = New-PesterConfiguration -Hashtable $pesterConfigHash $testResults = Invoke-Pester -Configuration $pesterConfig - Assert-True ($testResults.FailedCount -eq 0) "$($testResults.FailedCount) Pester test(s) failed." + Assert-True (($testResults.FailedCount + $testResults.FailedBlocksCount + $testResults.FailedContainersCount) -eq 0) "$($testResults.FailedCount) Pester test(s) failed." } # Synopsis: Run integration tests against live Confluence (Cloud or Data Center)