Skip to content

ci: pin Pester to v5 and fail on zero discovered tests - #3

Merged
BartoszBlizniak merged 10 commits into
mainfrom
fix/pin-pester-5
Jul 7, 2026
Merged

ci: pin Pester to v5 and fail on zero discovered tests#3
BartoszBlizniak merged 10 commits into
mainfrom
fix/pin-pester-5

Conversation

@BartoszBlizniak

Copy link
Copy Markdown
Member

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".

  • Pin install/import to Pester 5.x (-MinimumVersion 5.5 -MaximumVersion 5.99)
  • Run.PassThru + throw when TotalCount -lt 1, so an empty run can never be green again

This 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

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>
Copilot AI review requested due to automatic review settings July 7, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.5 and < 6.0 via -MaximumVersion 5.99.
  • Attempt to enforce non-empty discovery by enabling Run.PassThru and throwing when TotalCount -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
BartoszBlizniak and others added 4 commits July 7, 2026 12:09
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>
BartoszBlizniak and others added 4 commits July 7, 2026 12:43
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread install.ps1
Comment thread tests/helpers/Fixture.psm1
@BartoszBlizniak
BartoszBlizniak merged commit 035c464 into main Jul 7, 2026
13 checks passed
@BartoszBlizniak
BartoszBlizniak deleted the fix/pin-pester-5 branch July 16, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants