Mock clocks in testing help speed up time-dependent operations and prevent timer leaks, but often create unrealistic execution orders and require manual time advancement. Auto-advancing mock clocks solve these issues by automatically progressing time like real clocks, eliminating the need for explicit tick() calls and making tests work identically with or without mocked time. Jasmine 5.7, @sinonjs/fake-timers v15, and upcoming Jest releases now support this auto-advance feature through simple configuration.
Table of contents
Why use a mock clockCommon pitfalls with mock clocksGet Andrew Scott’s stories in your inboxProposal: Allow mock clocks to automatically advance timeUse casesWhat’s nextSort: