Skip to content

Also fail on Pester block/container failures (not just failed tests)#3404

Open
nohwnd wants to merge 1 commit into
microsoft:mainfrom
nohwnd:fix/pester5-count-blocks-containers
Open

Also fail on Pester block/container failures (not just failed tests)#3404
nohwnd wants to merge 1 commit into
microsoft:mainfrom
nohwnd:fix/pester5-count-blocks-containers

Conversation

@nohwnd

@nohwnd nohwnd commented Jul 7, 2026

Copy link
Copy Markdown
Member

⚠️ This PR was generated by an AI agent (GitHub Copilot CLI). Please review accordingly.

I've been seeing this commonly across Pester 5 build scripts and I'm fixing it where it looks like it could hide real failures.

In Pester 5 a run reports three independent failure counts:

  • FailedCount — failed tests (It)
  • FailedBlocksCount — failed BeforeAll / AfterAll
  • FailedContainersCount — files that error during discovery / fail to load

Gating on only FailedCount means a BeforeAll that throws, or a test file that fails to load, leaves FailedCount = 0 and the build passes green despite real failures. Pester itself derives the overall pass/fail from the sum of all three.

This includes all three counts in the gate, and surfaces each count (failed tests, blocks, containers) in the reported output instead of only the failed test count.

@nohwnd nohwnd requested a review from a team as a code owner July 7, 2026 12:24
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution, one of the team will evaluate shortly.

@nohwnd nohwnd force-pushed the fix/pester5-count-blocks-containers branch from a032ee4 to 122233b Compare July 7, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant