Guides
How to cache Jest transforms
Jest re-transforms every file on every run.
4 min read
Jest re-transforms every file on every run.
Why it happens
The transform cache directory is not persisted between jobs.
How to fix it
- Set --cacheDirectory to a stable path and cache it
- Key on the lockfile and the Babel or SWC config
- Switch the transformer to SWC or esbuild — usually a bigger win than the cache
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.
Related
How to make CI caches actually persistCaches are configured but hit rate is low.How to work around the 10 GB cache limitYour caches exceed 10 GB per repository and start silently evicting.How to share a build cache across repositoriesEach repository maintains its own cache for the same shared dependencies.How to share a Docker cache between jobsEach matrix leg rebuilds the same layers.