Fixes ENG-21288 TODO: Test with `@testing-library/react` `waitFor` --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
2.7 KiB
-
issue-207.test.ts: update webkit to allow overridenDateNow to be negative. we will have to pick some other value to be none, eg NaN.
-
process.hrtime (same as performance.now, resets to [0, 0] when fake timers are enabled)
-
decimal ticks should be supported: https://github.com/sinonjs/fake-timers/blob/main/test/issue-207-test.js
-
what happens when you add negative time?
-
test abortsignal
-
test spawnSync
-
support performance.now
-
support Date.now()
-
support useFakeTimers in combination with setSystemTime
-
support functions:
- advanceTimersByTime
- advanceTimersByTimeAsync*
- advanceTimersToNextTimer
- advanceTimersToNextTimerAsync*
- advanceTimersToNextFrame
- getTimerCount
- clearAllTimers
- getMockedSystemTime
- getRealSystemTime
- runAllTicks
- runAllTimers
- runAllTimersAsync*
- runOnlyPendingTimers
- make sure
[10, [20]], [30, [40]]runs 10, 20, and 30
- make sure
- runOnlyPendingTimersAsync
- setSystemTime
- useFakeTimers
- isFakeTimers
- useRealTimers
-
the result of 'arm' ('.disarm'/'.rearm') seems to be ignored? both disarm and rearm? we should change it to return void if it's actually ignored
- we can make this change seperately in main
-
see how fake timers works with setSystemTime
-
handle the config argument for useFakeTimers
- vitest has the toFake parameter for enabling nextTick and queueMicrotask
- jets has a timerLimit parameter
-
make sure there is no memory leak if you create a setTimeout/setInterval and clear or stop the fake timers before it fires repeatedly.
-
audit the allowFakeTimers list (do we want subprocess timeouts to count? and others)
- we will also need some timespec.now() calls to exclude mocked time, ie
timespec.nowUnmocked() - since test timeouts must be unmocked, we need BunTest timeouts to use unmocked time
- audit all timespec.now() calls to replace some with timespec.nowUnmocked()
- we will also need some timespec.now() calls to exclude mocked time, ie
-
add a test that fake timers do not break test duration calculations
-
test the order of '0' timeouts, decide if we will match or not
- consider supporting edge-case where
timeout0(A, timeout0(B)), timeout0(C)printsA=0, C=0, B=1(date.now())
- consider supporting edge-case where
-
* support async functions (maybe defer these for later? the first PR does not need to have everything. we can stub the unimplemented functions.)
-
add types for all functions
-
add docs for all functions (at minimum: documentatino comments in the types)
-
determine which tags should have timer-faking enabled (eg should subprocess timeout? probably not but maybe)
-
find real projects using fake timers, see if they work
-
make sure we match jest fake timers also