Jest - RAM Eater
summary
Jest consumes huge RAM on a multi-year monorepo (roughly a 2GB codebase) because Babel transpiles many files into large strings evaluated at runtime, GraphQL autmocking recreates a massive single-file API for each test, and Node v16–18 has memory regressions that push pipeline time from ~1h to 1.5–2h and require 16–32GB Node options. Fixes: replace Babel with swc transformer (rewriting some plugins), remove bulky HTML snapshots, split the GraphQL schema and use sharded GraphQL mocks with annotations, and wait for Node 20 fixes.
AI-written summary · about
chapters (11)
- 0:00Introduction and speaker intro
- 1:05Case study background
- 3:35Why Jest was chosen
- 5:23Testing as system engineering
- 7:52Snapshot and mocking issues
- 8:32Babel and RAM usage problem
- 9:55Solution with SWC
- 10:37GraphQL automocking challenge
- 11:39Sharding GraphQL APIs
- 12:01Node.js version upgrade impact
- 12:42Conclusion and Q&A
related talks
11mPerformant Bazel Builds for Web Monorepos at Scale
16mSpeeding up the EcoSystem
25mMetro: Scaling JavaScript Build Systems
20mScaling Testing at a Startup: Integration Testing GraphQL Services with Jest
27mBuilding High-Quality JavaScript Tools
20mBuilding with Monorepos
30mRefactoring large JavaScript codebases
30mReact Compiler
