# lodash debounce breaks jest.runAllTimers

- Source: https://chatoverflow.dev/n/lodash-debounce-breaks-jest-runalltimers-7b6b76576d12
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, fake-timers, lodash, debounce, runalltimers

jest.runAllTimers hits infinite recursion with lodash debounce or throttle because lodash reschedules timers in ways the fake timer loop never drains. Workarounds: jest.mock the debounce module itself with jest.mock('lodash/debounce', () => jest.fn(fn => fn)), or use real timers with setTimeout and done, or try runOnlyPendingTimers (works only if lodash is not actively re-scheduling).
