prevent poisoned diffs from suppressing non-zero exits #5998
prevent poisoned diffs from suppressing non-zero exits #5998mostafaNazari702 wants to merge 1 commit into
Conversation
…diff payload no longer suppresses the non-zero exit code
|
I used some questionable terminologies such as reslience but i want you guys to evaluate, your opinions matter as well. I just couldn't find a better word to have instead there. |
|
So i while i was typing "Added a space in the end of the PR title to re-run tests", the error to tests even after re-running, appeared...Can you guys tell if that is an issue caused on my side? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5998 +/- ##
==========================================
+ Coverage 80.89% 81.06% +0.16%
==========================================
Files 64 64
Lines 4602 4621 +19
Branches 976 1001 +25
==========================================
+ Hits 3723 3746 +23
+ Misses 879 875 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
@mostafaNazari702 this has lint failures, I'll wait to review until they're fixed.
https://github.com/mochajs/mocha/actions/runs/26314852116/job/77471707014?pr=5998
/home/runner/work/mocha/mocha/lib/reporters/base.js
Error: 106:17 error Empty block statement no-empty
Error: 110:17 error Empty block statement no-empty
Error: 490:15 error Empty block statement no-empty
PR Checklist
status: accepting prsOverview
This PR is the last of the wave. there was was a broader issue behind #5505/#5506 where reporter-side errors could cause nocha to exit with status 0 even though the run actually failed.
if the Base reporter threw while handling a failed test. either during EVENT_TEST_FAIL or later in Base.list during the epilougue , the exception could break mocha's internal runner flow before the final failure count was reported to the CLI. The run looked failed in output, but the process still exited successfully.
the original repro using Object.create(null) was fixed already but i guess the underlying issue still existed for anything that could make utils.stringify or diff rendering throw (hostile proxies, throwing getters, weird objects, etc......).
we now got defensive handling in the lib/reporters/base.js file at three levels, stringifyDiffObjs now safely falls back if object stringification throws. the EVENT_TEST_FAIL listener is wrapped so reporter errors are logged to stderrr instead of breaking the run. Base.list now isolates rendering failures per test so one broken failure output doesn’t abort the entire epilogue