Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(charts): polyfill performance.now() in jsdom test setup to fix PieChart flake (#65972)

mendral-app[bot]f0dd7af391d5
diff --git a/packages/quill/packages/charts/src/testing/jsdom.ts b/packages/quill/packages/charts/src/testing/jsdom.ts
index f6737602b7df..9ca721f55b40 100644
--- a/packages/quill/packages/charts/src/testing/jsdom.ts
+++ b/packages/quill/packages/charts/src/testing/jsdom.ts
@@ -60,6 +60,13 @@ export function setupSyncRaf(): () => void {
cb(0)
return 0
}) as typeof global.requestAnimationFrame
+
+ // Ensure `performance` is available in jsdom — the hover animation hook
+ // calls `performance.now()` and older jsdom versions don't expose it.
+ if (typeof global.performance === 'undefined') {
+ global.performance = { now: () => 0 } as unknown as Performance
+ }
+
return () => {
global.requestAnimationFrame = original
}