Jest Mock Reset Strategy Explainer
clearMocks vs resetMocks vs restoreMocks - what each actually does. They're cumulative, not alternatives, and picking the wrong one is a common source of state leaking between tests.
resetMocks: trueDoes everything clearMocks does, AND removes any mocked implementation - mockFn becomes a plain jest.fn() that returns undefined.
Use when: You want every test to explicitly set up its own mock behavior, so one test's mockReturnValue can't silently leak into the next.
Was this tool helpful?
See this same kind of analysis applied to your whole repository
Call graphs, dead code, blast radius, and a health score. Results in 60 seconds, free.
Related tools
See all Testing tools →Load Testing Capacity Calculator
Concurrent users and response time to required req/sec.
Test Flakiness Rate Calculator
Total runs and failures to a flakiness score - peaks near a 50/50 split, not a consistent failure.
Test Coverage Gap Calculator
Total lines, covered lines, and a target % to exactly how many more lines need coverage.
Test Selector Robustness Checker
Paste a CSS or test selector - flagged robust, moderate, or fragile based on what breaks in CI.
Test Pyramid Ratio Calculator
Unit, integration, and e2e counts - your test shape, and whether it inverted into the ice cream cone.
Runs entirely in your browser. Nothing is stored. Free forever.
