- All playbooks
- Transpile test sources once per run
Transpile test sources once per run
Compile the TypeScript that test subprocesses load once, before the tests start.
Company examples
How OpenAI used this technique
Read what OpenAI changed and follow the original sources.
Transpile test sources once per run
The Node SDK's tests start hundreds of child processes. Each used to load a TypeScript compiler and transpile the same sources; the suite now compiles the example, CLI and SDK sources once per Vitest invocation and points the subprocesses at that snapshot.
Node 22 job for the whole pull request, which also enables Node's compilation cache, bounded concurrency for package downloads and type checks, and an invariant JSON parse hoisted out of a property-test loop: 5m37s to 3m47s (1m32s before the regression on main), one successful run per revision Source
- Use it when
- A test suite starts many subprocesses that each transpile the same sources.
- Before applying it
- The compiled snapshot belongs to one run; never restore it across runs.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed