test({query-core,react-query,preact-query,solid-query}): pass 'unhandledRejectionFn' directly so 'process.off' removes the 'unhandledRejection' listener - #11610
Conversation
…nFn' directly so 'process.off' removes the 'unhandledRejection' listener
…o 'process.off' removes the 'unhandledRejection' listener
…so 'process.off' removes the 'unhandledRejection' listener
…o 'process.off' removes the 'unhandledRejection' listener
|
View your CI Pipeline Execution ↗ for commit 00e505f
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: TanStack/query/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughMutation tests across query-core and three framework adapters now register unhandled-rejection mocks directly. Query-core tests also check that rejection events include a Promise argument. ChangesMutation rejection tests
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Other Merge Risk: ⚪ Minimal · up to This PR updates rejection-listener tests without introducing an identified merge risk. It is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
size-limit report 📦
|
🎯 Changes
These tests registered an inline wrapper with
process.on('unhandledRejection', (error) => unhandledRejectionFn(error))but removedunhandledRejectionFninonTestFinished. Sinceprocess.offonly removes the exact function that was registered, the wrapper was never removed and kept handling unhandled rejections for the rest of the test file.unhandledRejectionFnis now passed directly toprocess.on, so the existingprocess.offremoves it:query-core:mutation.test.tsx(3),mutationObserver.test.tsx(2)react-query,preact-query,solid-query:useMutation.test.tsx(2 each)Since the listener now receives Node's
(reason, promise)arguments, theunhandledRejectionFnassertions inquery-coreaddexpect.any(Promise)as the second argument. The other packages do not assert onunhandledRejectionFn.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit