: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(jest): let V8 free finished test files (#114618)
Raúl Negrón-Otero643fcb01ab18
diff --git a/frontend/jest.setup.ts b/frontend/jest.setup.tsindex d88b163c4e37..bcf563e0fe00 100644--- a/frontend/jest.setup.ts+++ b/frontend/jest.setup.ts@@ -2,7 +2,13 @@ import 'jest-canvas-mock'import { configure } from '@testing-library/react'import { TextDecoder, TextEncoder } from 'util'-import { deserialize, serialize } from 'v8'+import { deserialize, serialize, setFlagsFromString } from 'v8'++// On Node 24 and later, V8 can keep every finished test file in memory after it optimizes Jest's own code,+// so the heap of a worker grows with each file that it runs. With retained maps off, V8 frees a finished file.+// Node rejects this flag in NODE_OPTIONS, so this file sets it.+// Remove this when the Node version in .nvmrc has the fix for https://github.com/nodejs/node/issues/66490+setFlagsFromString('--retain-maps-for-n-gc=0')// Jest/JSDom don't know about TextEncoder but the browsers we support do// https://github.com/jsdom/jsdom/issues/2524