You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When testing code which relies on the browser's requestAnimationFrame method, it would be great to have the ability to advance fake timers by the amount needed to execute any scheduled animation frames. sinonjs/fake-timers supports this with the clock.runToFrame() method, which Jest exposes as jest.advanceTimersToNextFrame().
Suggested solution
vi.advanceTimersToNextFrame() could be introduced to mirror the Jest implementation. This would be straightforward to implement (I am happy to make a PR) and would increase compatibility between Jest and Vitest.
Clear and concise description of the problem
When testing code which relies on the browser's
requestAnimationFrame
method, it would be great to have the ability to advance fake timers by the amount needed to execute any scheduled animation frames.sinonjs/fake-timers
supports this with theclock.runToFrame()
method, which Jest exposes asjest.advanceTimersToNextFrame()
.Suggested solution
vi.advanceTimersToNextFrame()
could be introduced to mirror the Jest implementation. This would be straightforward to implement (I am happy to make a PR) and would increase compatibility between Jest and Vitest.Example:
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: