Fix #2538: Container/block with discovery errors reported as Failed#2694
Merged
Conversation
Member
Author
|
you need to add tests. |
…iled Copilot-generated fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7a15c8b to
4204472
Compare
nohwnd
commented
Apr 3, 2026
Member
Author
|
🤖 Tests added in latest push — verifies discovery error yields Failed result. |
The previous test used BeforeAll { throw }, which is an execution-time
error. That triggers the existing ShouldRun/Executed Failed branch, so
the container would already report Failed without this fix and the test
passed on the buggy code as well.
Replace it with the actual repro from pester#2538: an It that runs (making
the container Passed=true) followed by a throw at the bottom of the
Describe body that fails discovery (populating ErrorRecord). This is the
exact case where the old precedence (Passed before ErrorRecord) returned
Passed for an obviously-failed container, and where the fix flips it to
Failed.
Verified: the new test fails on the previous main and passes on this
branch. Kept the BeforeAll case as a smoke test alongside.
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 #2538
Reordered result-computation logic in
PostProcess-RSpecTestRunso that a non-emptyErrorRecordalways yields Failed, regardless of other flags.Copilot-generated fix.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com