fix(test): clear boundedPromise timers to prevent unhandled rejections in abort-and-lifecycle test#4220
Conversation
boundedPromise timeouts could fire after test completion, causing vitest to exit with code 1 due to unhandled rejection. Add clear() method and cleanup all pending timers in the finally block.
📋 Review SummaryThis PR addresses a CI E2E test failure caused by dangling 🔍 General Feedback
🎯 Specific Feedback🔵 Low
✅ Highlights
|
wenshao
left a comment
There was a problem hiding this comment.
No review findings. Downgraded from Approve to Comment: self-PR; CI still running. — gpt-5.5 via Qwen Code /review
pomelo-nwu
left a comment
There was a problem hiding this comment.
LGTM. The timer cleanup is scoped to the test harness and preserves the existing behavioral assertions. Please wait for the remaining Windows CI check to pass before merging.
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
wenshao
left a comment
There was a problem hiding this comment.
No issues found. The fix is clean and correctly addresses the unhandled-rejection root cause:
timer = undefinedset afterclearTimeoutin both resolve and timeout paths prevents double-clear and stale timer references- New
clear()method encapsulates safe timer teardown pendingTimersarray covers all four bounded promises used in the testfinallyblock clears timers beforeq.close(), ensuring no dangling callbacks fire after test completion
— glm-5.1 via Qwen Code /review
Summary
boundedPromiseinabort-and-lifecycle.test.tsto prevent danglingsetTimeoutcallbacks from firing after test completion.secondResult timeout after 30000ms. All tests passed but the leftover timer triggered vitest's unhandled error detection.boundedPromisenow returns aclear()method; all four bounded promises are collected inpendingTimersand cleared in thefinallyblock beforeq.close().Validation
# Local syntax check (pre-commit hook passes) npm run buildsecondResulttimer firing after the test body completed, producingUnhandled Rejection→ exit code 1.clear()properly callsclearTimeoutand thatpendingTimerscovers all four bounded promises used in the test.Scope / Risk
boundedPromise.Testing Matrix
Testing matrix notes:
Linked Issues / Bugs
No linked issues.
🤖 Generated with Qwen Code