Skip to content

ci: print a failed-test summary at the end of the Pester run - #115

Merged
mikemadeja merged 1 commit into
developfrom
ci/pester-failed-test-summary
Sep 26, 2026
Merged

mikemadeja merged 1 commit into
developfrom
ci/pester-failed-test-summary

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

Pester's own console output shows each failure inline as it happens, but nothing at the very end lists which tests failed without scrolling back through a (sometimes 1000+ line) log. Adds a short "FAILED TESTS" block right after the run, listing each failed test's full Describe/It path and error message - e.g.:

==================================================
 FAILED TESTS (1)
==================================================

[-] Remove-PiHoleGroup (Integration).returns the raw API response when RawOutput is set
    Response status code does not indicate success: 400 (Bad Request).

This meant switching Run.Exit from $true to $false and calling exit manually with the failure count afterward, since Invoke-Pester's own Run.Exit handling calls exit internally and would skip the summary entirely.

Also fixed a real, separately-discovered issue while touching this file: the "Ensure Pester 5 is available" step only checked -ge 5.0.0, which would silently accept a newer major version like 6.x if one happened to already be installed on the agent - which is exactly what was found installed on the shared self-hosted agent (v6.2.0, whose result-object shape can't be assumed compatible with 5.x, the version this whole pipeline's Pester-specific code actually targets, including the new summary logic). Both the install check and Import-Module now pin to the 5.x range specifically.

Test plan

  • Verified both the failing and all-passing paths locally against real Pester runs: the summary prints correctly (and only) on failure, and the exit code correctly reflects the failure count in both cases

🤖 Generated with Claude Code

Pester's own console output already shows each failure inline as it
happens, but nothing at the very end lists which tests failed without
scrolling back through a (sometimes 1000+ line) log. Adds a short
"FAILED TESTS" block after the run, listing each failed test's full
Describe/It path and error message.

This meant switching Run.Exit from $true to $false and calling exit
manually with the failure count, since Invoke-Pester's own Run.Exit
handling calls exit internally and would skip the summary entirely.
Verified both the failing and all-passing paths locally: the summary
prints and the exit code is correct in both cases.

Also fixed a real, separately-discovered issue while touching this file:
the "Ensure Pester 5 is available" step only checked "-ge 5.0.0", which
would silently accept a newer major version like 6.x if one happened to
already be installed on the agent - which is exactly what was found
installed on the shared self-hosted agent (v6.2.0, whose result-object
shape can't be assumed compatible with 5.x, the version this whole
pipeline's Pester-specific code actually targets). Both the install check
and Import-Module now pin to the 5.x range specifically.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mikemadeja mikemadeja closed this Sep 26, 2026
@mikemadeja mikemadeja reopened this Sep 26, 2026
@mikemadeja
mikemadeja merged commit eb5a4e3 into develop Sep 26, 2026
5 checks passed
@mikemadeja mikemadeja mentioned this pull request Sep 26, 2026
1 task done
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