Remove unnecessary jest.(clear/reset)AllMocks calls#4140
Remove unnecessary jest.(clear/reset)AllMocks calls#4140imnasnainaec merged 2 commits intomasterfrom
Conversation
📝 WalkthroughWalkthroughRemoved per-test mock-reset calls ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4140 +/- ##
==========================================
- Coverage 74.76% 65.72% -9.05%
==========================================
Files 295 241 -54
Lines 10958 6200 -4758
Branches 1371 787 -584
==========================================
- Hits 8193 4075 -4118
+ Misses 2368 1870 -498
+ Partials 397 255 -142
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai Your "Walkthrough" repeatedly claims that mocks persist between tests. You're not taking into account that |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1138
With this configuration:
My summaries incorrectly claimed that removing these calls would cause mocks to persist across tests, which is not the case. The PR changes are correctly removing unnecessary code without affecting test behavior. Thank you for catching this error! ✏️ Learnings added
|
@coderabbitai Please update your previous "Walkthrough" comment accordingly. |
|
However, I can trigger a complete regeneration of the PR summary and walkthrough, which will replace the previous one with corrected information that accurately reflects the fact that Would you like me to regenerate the entire summary/walkthrough with the corrected information? 🧠 Learnings used✅ Actions performedSummary regeneration triggered. |
@coderabbitai Yes, regenerate the entire summary. |
|
The key correction needed: The previous summaries incorrectly stated that "mocks persist across tests" after removing the The regenerated summary will accurately reflect that these changes simply remove unnecessary code without affecting test behavior. 🧠 Learnings used✅ Actions performedSummary regeneration triggered. |
jasonleenaylor
left a comment
There was a problem hiding this comment.
@jasonleenaylor reviewed 52 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec).
Our https://github.com/sillsdev/TheCombine/blob/master/jest.config.json has
"resetMocks": true,. So it's completely useless to calljest.clearAllMocksorjest.resetAllMocksin thebeforeEachof any of our test files.Also cleaned up the spy handling in
src/goals/Redux/tests/GoalRedux.test.ts.This change is
Summary by CodeRabbit