Skip to content

Fix #2538: Container/block with discovery errors reported as Failed#2694

Merged
nohwnd merged 2 commits into
pester:mainfrom
nohwnd:fix-2538-discovery-errors
Jun 11, 2026
Merged

Fix #2538: Container/block with discovery errors reported as Failed#2694
nohwnd merged 2 commits into
pester:mainfrom
nohwnd:fix-2538-discovery-errors

Conversation

@nohwnd

@nohwnd nohwnd commented Apr 3, 2026

Copy link
Copy Markdown
Member

Fix #2538

Reordered result-computation logic in PostProcess-RSpecTestRun so that a non-empty ErrorRecord always yields Failed, regardless of other flags.

Copilot-generated fix.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@nohwnd

nohwnd commented Apr 3, 2026

Copy link
Copy Markdown
Member Author

you need to add tests.

…iled

Copilot-generated fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd force-pushed the fix-2538-discovery-errors branch from 7a15c8b to 4204472 Compare April 3, 2026 10:18
Comment thread tst/Pester.RSpec.ts.ps1 Outdated
@nohwnd

nohwnd commented Apr 3, 2026

Copy link
Copy Markdown
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>
@nohwnd nohwnd marked this pull request as ready for review June 11, 2026 16:20
@nohwnd nohwnd merged commit b94d9f8 into pester:main Jun 11, 2026
13 checks passed
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.

Container is reported as Passed/Successful when discovery fails

1 participant