Our tests grew 14x. Our PR check got faster anyway.
A PR check went from 4.7 minutes to 1.8 while the suite grew almost 14x. On the August pipeline it would take 16. What worked, and what only looked like it worked.
In August a PR check in our frontend repo took 4.7 minutes. Then the team started shipping with coding agents, and every change brought tests. By November the suite had almost 14x the tests it had in August.
That pipeline was never built for 14x. Project the August setup to today’s test count and a check takes 16 minutes. Ours takes 1.8.
Watch the blue line on a replay. It doesn’t slide down. It drops, climbs back, and on 15 September it spikes to 13.4 minutes, a bold move for a line we were trying to push down.
Three rounds of changes got us here. Only two of them helped the machines.
Round 1: more shards, same bill
By 1 September a check took 7.7 minutes, and unit tests were most of it. So we split them across 8 machines instead of 4, and cut fixed costs out of every step.
On 29 September the check took 4.0 minutes. Almost twice as fast. Now switch the chart to runner minutes: 32 before, 30 after. Same bill.
Each runner spent about 2 minutes on setup before it ran a single test.
More shards buy speed. They don’t buy runner minutes.
By 3 November the suite had caught up. The check was back at 4.5 minutes and 34 runner minutes, more than in August.
Round 2: tools that do less work
A faster tool cuts the run and the runner minutes at once, because the step does less work. In the first week of November oxlint replaced ESLint, TypeScript 7 took over the type check with --checkers 2, and one zstd archive started holding node_modules. On 9 November, Vite 8 with Rolldown took over the build.
The tools got faster. The tests still paid setup in every file.
Round 3: stop paying setup per file
Vitest isolates test files by default. Every file gets a clean environment and imports its modules again. Across a big suite, that setup costs more than the tests do.
We turned it off with isolate: false.
Sounds free. In practice, the suite was isolated for a reason:
// file A sets something global and never clears it
cache.set('user', fakeUser);
// file B runs next in the same worker, and fails only when A ran first
expect(cache.get('user')).toBeNull();
That’s an illustration, not our code. The fix doesn’t go into file B. One reset file runs first for every test file and cleans the module registry, mocks, timers, the DOM, storage and listeners. One fix covers a whole class of leak. The proof is a rerun in shuffled order, and every file passes both ways.
Fast tests, then. But every merged change still ran the whole check twice.
Round 3, part 2: do the work once
Until 10 November, a merged change ran every check in the merge queue, and then master ran them all again on the same commit.
PRs also started to run only the tests their change can reach.
On 17 November a check took 1.8 minutes and 12 runner minutes. That’s less than August’s 21, with almost 14x the tests. Merge to live, the third tab, fell from 8.6 minutes on 3 November to 3.1.
Find the repeated work
I want to see what Bun does to this suite.
Before you buy more runners, find the work every run repeats: setup per shard, setup per file, a second run on the same commit. Do it once. More machines only spread it out.