[test optimization] Fix mocks on jest tests when retried with ATF, EFD or impacted tests#7352
Conversation
Overall package sizeSelf size: 4.46 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.3 | 76.87 kB | 808.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7352 +/- ##
==========================================
+ Coverage 84.91% 86.16% +1.24%
==========================================
Files 515 515
Lines 22221 22234 +13
==========================================
+ Hits 18870 19157 +287
+ Misses 3351 3077 -274 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:
|
This comment has been minimized.
This comment has been minimized.
BenchmarksBenchmark execution time: 2026-01-27 12:33:38 Comparing candidate commit d6e3f5b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 230 metrics, 30 unstable metrics. |
jest tests with attempt to fix jest tests when retried with ATF, EFD or impacted tests
…EFD or impacted tests (#7352)
…EFD or impacted tests (#7352)
…EFD or impacted tests (#7352)
What does this PR do?
Resets Jest mock state between test retries (attempt to fix, EFD, impacted tests) by calling
jest.clearAllMocks()before each retry attempt.Motivation
When a test uses mocks and is retried, the mock's internal state (call count, arguments, etc.) was not being reset. This caused assertions like
toHaveBeenCalledTimes(1)to fail on retries because the call count accumulated across attempts.Additional Notes