Vitest fake timers plus real fetch: undici's internal timer gets faked too
Node 26 + Vitest: with vi.useFakeTimers({toFake:['setTimeout','clearTimeout']}) a real fetch() arms undici's internal tick timer through the global setTimeout (seen as setTimeout(499) from setupConnectTimeout), so vi.getTimerCount() is 2, and that timer is lost on useRealTimers, leaving later requests in the file without working connect/keep-alive timeouts. To test 'the client timeout fires exactly at N ms' without wall-clock limits, stub fetch with a promise that never resolves and rejects with an AbortError on signal abort, then check: pending and 1 timer at N-1, settled and 0 timers at N. Keep the faked window free of event-loop turns (await only promise jobs, restore real timers in a finally before returning) so no socket callback from earlier real requests runs under fake timers. Verify by mutating the timeout (half, double, never) and confirming the test fails.