Skip to content

fix(ui): polyfill animation frames in tests - #3930

Merged
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/fix-ui-request-animation-frame-test-flake
Jul 29, 2026
Merged

fix(ui): polyfill animation frames in tests#3930
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/fix-ui-request-animation-frame-test-flake

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

The UI unit suite can finish every assertion successfully and still fail when react-zoom-pan-pinch runs a delayed animation callback from ArtifactPreview.test.tsx. jsdom does not provide requestAnimationFrame, so the callback raises an unhandled ReferenceError later in the suite.

Changes

  • Add jsdom test polyfills for requestAnimationFrame and cancelAnimationFrame
  • Keep the behavior asynchronous and cancellable to match the browser API used by animation libraries

Why: Browser animation callbacks should behave consistently in UI tests and must not turn passing suites into intermittent CI failures

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
@trunk-io

trunk-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 51f4815.

@tatoalo tatoalo self-assigned this Jul 29, 2026
@tatoalo
tatoalo marked this pull request as ready for review July 29, 2026 14:56
@tatoalo
tatoalo enabled auto-merge (squash) July 29, 2026 14:57
@tatoalo
tatoalo requested a review from a team July 29, 2026 14:57
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "Merge branch 'main' into posthog-code/fi..." | Re-trigger Greptile

@trunk-io
trunk-io Bot merged commit 92c2a07 into main Jul 29, 2026
39 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/fix-ui-request-animation-frame-test-flake branch July 29, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants