Render Describing/Context headers in parallel Detailed output#2853
Merged
Conversation
In a parallel run each file is executed by a silent worker whose result tree is replayed to the parent's reporting plugins. The worker's end-of-run cleanup (Remove-RSpecNonPublicProperties) strips each block's FrameworkData, which carries the Describe/Context command name. Because the replayed tape holds live references to those same block objects, the parent was left without a CommandUsed and could not render the "Describing"/"Context" headers in Detailed/Diagnostic output. Keep the raw result object in the worker so FrameworkData survives until the parent has replayed the tape; the parent runs the same cleanup on the merged tree, so the user still receives a cleaned result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fflaten
approved these changes
Jul 9, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Fix #2824
Problem
In a parallel run (
Run.Parallel = $true) withOutput.Verbosityset toDetailedorDiagnostic, theDescribing .../Context ...block headers were missing from the console output. They render correctly in a sequential run.Root cause
Each file in a parallel run is executed by a silent worker (
Output.Verbosity = None) whose plugin events are recorded onto a "tape" of liveBlock/Testobjects. The parent replays that tape to its reporting plugins to produce console output.At the end of every run Pester calls
Remove-RSpecNonPublicProperties, which nulls each block'sFrameworkData.FrameworkData.CommandUsedis what tells the output plugin whether a block is aDescribeor aContext. Because the tape holds live references to the very same block objects, the worker's own end-of-run cleanup blanked outFrameworkDatabefore the parent replayed the tape.Write-BlockToScreenthen indexed a report hashtable with a$nullkey, threw, and the error was swallowed by the non-throwing replay path — so the header silently disappeared.Sequential runs are unaffected because they write output during the run, before that cleanup runs.
Fix
Set
Debug.ReturnRawResultObject = $trueon the worker configuration so the worker skips the cleanup and leavesFrameworkDataintact on the live tape objects. The parent performs the same cleanup itself on the merged result tree after replaying the tape, so the object returned to the user is still cleaned exactly as before.Tests
Added a test in
tst/Pester.RSpec.Parallel.ts.ps1asserting thatDescribing/Contextheaders appear inDetailedoutput for a parallel run. Full parallel and output suites pass.