Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scheduler] Improve naive fallback version used in non-DOM environments #13740

Merged
merged 1 commit into from
Sep 27, 2018

Commits on Sep 27, 2018

  1. [scheduler] Improve naive fallback version used in non-DOM environments

    Added some tests for the non-DOM version of Scheduler that is used
    as a fallback, e.g. Jest. The tests use Jest's fake timers API:
    
    - `jest.runAllTimers(ms)` flushes all scheduled work, as expected
    - `jest.advanceTimersByTime(ms)` flushes only callbacks that expire
    within the given milliseconds.
    
    These capabilities should be sufficient for most product tests. Because
    jest's fake timers do not override performance.now or Date.now, we
    assume time is constant. This means Scheduler's internal time will not
    be aligned with other code that reads from `performance.now`. For finer
    control, the user can override `window._sched` like we do in our tests.
    We will likely publish a Jest package that has this built in.
    acdlite committed Sep 27, 2018
    Configuration menu
    Copy the full SHA
    4d17c3f View commit details
    Browse the repository at this point in the history