fix: report test error when afterEach also fails on retry#5990
Open
mostafaNazari702 wants to merge 3 commits into
Open
fix: report test error when afterEach also fails on retry#5990mostafaNazari702 wants to merge 3 commits into
mostafaNazari702 wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5990 +/- ##
==========================================
- Coverage 80.89% 78.15% -2.75%
==========================================
Files 64 63 -1
Lines 4602 4595 -7
Branches 976 978 +2
==========================================
- Hits 3723 3591 -132
- Misses 879 1004 +125 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JoshuaKGoldberg
approved these changes
Jun 7, 2026
JoshuaKGoldberg
left a comment
Member
There was a problem hiding this comment.
LGTM! Just the one question on test style discrepency?
| failureMessages.indexOf("Error from after each") !== -1, | ||
| "expected the afterEach hook error to be reported, got: " + | ||
| JSON.stringify(failureMessages), | ||
| ); |
Member
There was a problem hiding this comment.
[Testing] The other tests have more precise checks on the raw lines of output. Is there a reason you didn't go for that here?
Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.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.
PR Checklist
status: accepting prsOverview
The fix wraps the retry-branch hookUp(AFTER_EACH, ...) callback so that if afterEach fails the original test error is still surfaced via
self.fail(test, err)before forwarding the hook error tonext.I did not touch the normal retry flow: if afterEach succeeds, execution continues exactly as before.
Change is minimal and isolated to the retry path in
lib/runner.jsand does not affect:--retries 0or successful retries orEVENT_TEST_RETRYordering or non-retryEVENT_TEST_PASSbehavior.