This site is open for sponsorshipHow it works →
CI cost figures are vendor list prices verified November 2026. Actual cost depends on plan, concurrency, and discount terms. Vendor links are direct, unpaid. How we work.

Updated December 2026 · 9 min read

Stop running every test on every PR

Full test suites running on every PR commit, even when the change touches a single package, and flaky tests that fail at random and trigger re-runs. Every one of those minutes is billed. Test optimisation is the next lever after caching.

§ 01

Strategy 1: Test sharding

Sharding splits a test suite across N parallel runners. A 15-minute test run on 5 shards takes 3 minutes. The total billed minutes are the same, but wall-clock time drops 5x. Trade-off: sharding does not reduce cost, it reduces latency.

strategy:
  matrix:
    shard: [1, 2, 3, 4, 5]
steps:
  - run: npx jest --shard=${{ matrix.shard }}/5
  # Python: pytest --splits 5 --group ${{ matrix.shard }}
  # Go: go test -run TestShard_${{ matrix.shard }}
§ 02

Strategy 2: Flaky test detection

Part of many teams' “slow CI” problem is a handful of flaky tests that fail intermittently, trigger re-runs, and consume minutes that could have been prevented. Identifying and quarantining flaky tests before fixing them is a fast intervention.

Buildpulse

Identifies flaky tests from historical run data. Shows flakiness rate per test, time to fix, and impact on CI time. Free tier available.

buildpulse.io

CloudBees Smart Tests (formerly Launchable)

ML-based test selection: predicts which tests are relevant for a given PR from historical run data. launchableinc.com now redirects to it. How many tests it skips depends on your history, so measure it on your own suite.

cloudbees.com/capabilities/cloudbees-smart-tests

Trunk.io Flaky Tests

Auto-quarantines flaky tests to a separate run. Tests in quarantine do not block PR merges but continue to run to detect fixes.

trunk.io

§ 03

Strategy 3: Test impact analysis

Test impact analysis runs only the tests affected by the specific code changes in a PR. Requires a tool that understands your test-to-code dependency map.

CloudBees Smart Tests

Formerly Launchable. ML model trained on your test history. Requires instrumentation but works across languages. Best for large mixed-language codebases.

Bazel query

DIY for Bazel monorepos. bazel query 'tests(...)' combined with changed-file detection gives precise test selection without a third-party tool.

Nx affected

Built into Nx. nx affected:test runs tests for all packages affected by changes since the base branch. Zero configuration overhead.

Turborepo

Via task-level caching. If a package has not changed and its dependencies have not changed, the test task is a cache hit and is skipped entirely.

§ 04

Cost worked example

ILLUSTRATIVE: 20-MIN npm test, 80 PR RUNS/DAY, 22 WORKING DAYS, $0.006/MIN LINUX

Baseline: 20 min × 80 runs × 22 days35,200 min → $211/mo
If fail-fast brings the average to 15 min (assumed)$158/mo
If test selection brings it to 3 min (assumed)$32/mo
On these assumptions85% lower

Updated 2026-12-05