Jest
Jest CI on GitHub Actions
Jest transforms every file on every run and uses one worker in CI.
90s → 8s
Transform time
14m → 3m
Test suite
Jest transforms every file on every run and uses one worker in CI.
Why it happens
The Jest transform cache is not persisted and --ci defaults are conservative about workers.
What to change
- Cache the Jest cache directory keyed on the lockfile and config
- Set --maxWorkers to the core count instead of accepting the default
- Use --shard across a matrix for suites over ten minutes
- Switch the transformer to SWC or esbuild — Babel is usually the bottleneck
Jest on runnerhut
yaml
jobs: test: runs-on: runnerhut-8vcpu-ubuntu-2404 steps: - uses: actions/checkout@v4 - run: npm ci - run: npx jest --ci --maxWorkers=8 --cacheDirectory=/tmp/jest_cacheThe only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.
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.