fix(ui): polyfill animation frames in tests - #3930
Merged
trunk-io[bot] merged 2 commits intoJul 29, 2026
Merged
Conversation
Provide requestAnimationFrame and cancelAnimationFrame in the jsdom setup so delayed callbacks from browser animation libraries cannot fail after their originating test has completed. Generated-By: PostHog Code Task-Id: 751a37dc-0eb5-4201-9a10-e2c694aada61
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
tatoalo
marked this pull request as ready for review
July 29, 2026 14:56
tatoalo
enabled auto-merge (squash)
July 29, 2026 14:57
Contributor
|
Reviews (1): Last reviewed commit: "Merge branch 'main' into posthog-code/fi..." | Re-trigger Greptile |
adboio
approved these changes
Jul 29, 2026
trunk-io
Bot
deleted the
posthog-code/fix-ui-request-animation-frame-test-flake
branch
July 29, 2026 15:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The UI unit suite can finish every assertion successfully and still fail when
react-zoom-pan-pinchruns a delayed animation callback fromArtifactPreview.test.tsx. jsdom does not providerequestAnimationFrame, so the callback raises an unhandledReferenceErrorlater in the suite.Changes
requestAnimationFrameandcancelAnimationFrameWhy: Browser animation callbacks should behave consistently in UI tests and must not turn passing suites into intermittent CI failures