ci: pin Pester to v5 and fail on zero discovered tests - #3
Merged
Conversation
Install-Module -MinimumVersion 5.5 resolved the new Pester 6.0.0, which discovers this v5 suite as zero tests and exits green. Pin to 5.x and throw when discovery finds nothing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows CI workflow to ensure the PowerShell Pester test suite actually runs (by pinning Pester to v5.x) and to prevent “green” runs when zero tests are discovered.
Changes:
- Pin Pester installation/import to
>= 5.5and< 6.0via-MaximumVersion 5.99. - Attempt to enforce non-empty discovery by enabling
Run.PassThruand throwing whenTotalCount -lt 1.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
167
to
+171
| $config.Run.Exit = $true | ||
| $config.Run.PassThru = $true | ||
| $config.Output.Verbosity = "Detailed" | ||
| $config.Should.ErrorAction = "Stop" | ||
| Invoke-Pester -Configuration $config | ||
| $result = Invoke-Pester -Configuration $config |
Comment on lines
182
to
+186
| $config.Run.Exit = $true | ||
| $config.Run.PassThru = $true | ||
| $config.Output.Verbosity = "Detailed" | ||
| $config.Should.ErrorAction = "Stop" | ||
| Invoke-Pester -Configuration $config | ||
| $result = Invoke-Pester -Configuration $config |
Candidate hosts were computed in BeforeAll (run phase) while the foreach creating the per-host Contexts executes at discovery, so the suite always discovered zero tests. Hosts are now enumerated at discovery and passed to the run phase via -ForEach. checkout bumped for the Node 20 deprecation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Stop() blocked forever in PowerShell.Stop()/EndInvoke when the server's GetContext() had never received a request (first test that skips the server hangs in AfterEach). Shutdown now stops the listener and waits at most 5s, leaking the daemon runspace instead of deadlocking. Job-level timeout-minutes added so any future hang fails fast. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The in-process HttpListener ran on a foreground runspace thread; when a test never sent it a request the thread stayed blocked in GetContext() and kept the PowerShell host alive after the run finished. A child process is killed deterministically on Stop(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Move-Item -Destination parses wildcard characters, so install roots containing e.g. [ ] failed during activation. Directory.Move treats both paths literally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Windows PowerShell applies wildcard matching to Invoke-WebRequest -OutFile, so the insecure download path now writes to a temp file and copies it to the destination literally. Checksum verification hashes via .NET instead of Get-FileHash, whose discovery can fail when concurrent Windows PowerShell startups race on the module analysis cache. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The multi-segment Join-Path form is PowerShell 6+ only and fails discovery when the suite itself runs under Windows PowerShell 5.1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…owerShell Windows PowerShell converts redirected native stderr into error records, so the installer's first diagnostic line became a terminating error under Pester's ErrorAction Stop. Relax the preference inside Invoke-Installer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Start-Process -PassThru returns a null ExitCode in Windows PowerShell unless the handle is cached before the child exits. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pester 6.0.0 (pulled in by
-MinimumVersion 5.5) discovers this v5 suite as zero tests and exits green — so the Windows suite has never actually executed in CI, including on the runs that showed "Test PowerShell: pass".-MinimumVersion 5.5 -MaximumVersion 5.99)Run.PassThru+ throw whenTotalCount -lt 1, so an empty run can never be green againThis PR is the first genuine execution of the Pester suite on Windows — treat any failures it surfaces as newly-revealed, not regressions.
🤖 Generated with Claude Code