Skip to content

Test stray output during a real run, not only Split-RSpecResult#2822

Merged
nohwnd merged 1 commit into
mainfrom
nohwnd-stray-output-realrun-test
Jun 30, 2026
Merged

Test stray output during a real run, not only Split-RSpecResult#2822
nohwnd merged 1 commit into
mainfrom
nohwnd-stray-output-realrun-test

Conversation

@nohwnd

@nohwnd nohwnd commented Jun 30, 2026

Copy link
Copy Markdown
Member

Fix #2818

Background

PR #2746 (Fix #2655, "Don't crash the run on stray output during a test run") added two tests, but as noted in review both only exercised internals — Split-RSpecResult and the typed result list — so neither actually ran Pester end-to-end with stray output.

Change

  • Add a real Invoke-Pester run that deterministically leaks stray output to the success stream from Run.BeforeContainer (dot-sourced inside Invoke-Test's container loop, the same Invoke-TestSplit-RSpecResult path a stray native-command write hits). It asserts the run completes, the container and its results are kept, and a warning is emitted instead of the run crashing.
  • Keep a focused Split-RSpecResult unit test for the separation logic.
  • Drop the redundant test that only asserted the typed list throws on stray output.

Validation

tst/Pester.RSpec.ts.ps1 — 116 P-tests pass (verified in isolation on main).

The two tests added in #2746 only exercised internals (Split-RSpecResult
and the typed result list), so neither covered a real run that emits stray
output. Replace the redundant one with an end-to-end Invoke-Pester run that
leaks to the success stream from Run.BeforeContainer - the same path a stray
native-command write takes - and assert the run completes with its results
intact and a warning instead of crashing. Keep a focused Split-RSpecResult
unit test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd added this to the 6.0.0 milestone Jun 30, 2026
@nohwnd nohwnd merged commit ef95a19 into main Jun 30, 2026
13 checks passed
@nohwnd nohwnd deleted the nohwnd-stray-output-realrun-test branch June 30, 2026 18:25
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.

review new test Pester crashes due to native command output in BeforeAll

1 participant