Skip to content

Vitest

Vitest CI on GitHub Actions

Vitest re-optimises dependencies and runs in a single thread pool.

30s → 1s
Dep optimise
6m → 80s
Test suite

Vitest re-optimises dependencies and runs in a single thread pool.

Why it happens

node_modules/.vite is discarded and the default pool configuration is conservative.

What to change

  1. Cache node_modules/.vite keyed on the lockfile
  2. Use --pool=threads with maxThreads set to the core count
  3. Shard with --shard for large suites

Vitest on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-8vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx vitest run --pool=threads --reporter=dot
A working starting point

The 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.