trimtest 0.1: run only the tests a change can reach
December 2, 2026 · trimtest v0.1.1
trimtest is out. It looks at what you changed and runs only the tests that change can reach, with each project’s own runner. A pull request that touches one file runs the tests for that file, not the whole suite.
What it does
Section titled “What it does”- Static selection, zero setup. trimtest parses your code with tree-sitter, builds an import graph per language, and walks it backwards from the changed files to the tests. Edits that do not change code (comments, formatting) select nothing.
- A recorded tier when you want precision.
trimtest record --coveragerecords per-test coverage with each ecosystem’s own tool (coverage.py, V8,cargo llvm-cov, JaCoCo, Dart and Flutter coverage, Chromium for Playwright) and selects at function level instead. - It runs more, never fewer. When trimtest cannot trace a change (a lockfile, a build config, a test that loads code through a computed path, a parse error), it runs everything for that project. Failed tests always rerun.
- Your runner, not ours.
trimtest runcalls pytest, Jest, Vitest, Playwright,cargo test,go test, Gradle, Maven, SwiftPM and the rest with their own filters. Exit codes are plain: 0 passed or nothing selected, 1 a test failed, 2 trimtest failed, 3 selection is uncertain.
It covers Python, JS/TS, Rust, Go, Dart/Flutter, Java, Kotlin, Swift, Ruby, PHP, .NET, Elixir, Zig and SQL. The support matrix says which runners are stable, which are beta, and which are experimental.
Install
Section titled “Install”# Linux and macOS (x86_64, arm64): verifies the checksum, installs to ~/.local/bincurl -fsSL https://raw.githubusercontent.com/RabinApps/trimtest/main/install.sh | sh
# Windows (PowerShell)irm https://raw.githubusercontent.com/RabinApps/trimtest/main/install.ps1 | iex
# anywhere with Rustcargo install trimtest
# Windows with Scoopscoop bucket add rabinapps https://github.com/RabinApps/scoop-bucketscoop install trimtestA winget package is pending review. Prebuilt archives and checksums are on the release page.
Try it in a minute
Section titled “Try it in a minute”cd your-repotrimtest detect # what it foundtrimtest record # take a baseline (after a green run)# edit a filetrimtest select # the tests that change can reach, and whytrimtest run # run just those with the native runnerIn a pull request, trimtest run --base origin/main needs no recorded map. Keep a scheduled full run as a safety net: a
green subset is not a green suite. The quick start and the
GitHub Actions guide have the details.
How far to trust it
Section titled “How far to trust it”Soundness comes first: the rule is that trimtest may run too many tests but must never skip one it should have run. To check
that, the repository ships a mutation benchmark (bench/bench.py). It injects one small fault at a time into a real project’s
source and compares the full suite with the selected subset. A miss is a fault the full suite catches and the subset does
not. The target is zero.
Before this release I re-ran it on the released binary, on repositories that exercise the parsers and the coverage readers: nine runs across Go, Rust, Python, TypeScript and Java, static and recorded, 6 mutations each (4 for the Maven run), seed 1.
| Repository | Runner | Tier | Test units | Faults the full suite caught | Missed by trimtest | Mean tests selected |
|---|---|---|---|---|---|---|
| go-chi/chi | Go | static | 35 | 3 of 6 | 0 | 74% |
| dtolnay/semver | cargo | static | 6 | 4 of 6 | 0 | 83% |
| pallets/click | pytest | static | 43 | 5 of 6 | 0 | 100% |
| pallets/click | pytest | recorded | 43 | 5 of 6 | 0 | 40% |
| unjs/ufo | Vitest | static | 13 | 6 of 6 | 0 | 95% |
| unjs/ufo | Vitest | recorded | 13 | 6 of 6 | 0 | 37% |
| unjs/pathe | Vitest | recorded | 4 | 6 of 6 | 0 | 71% |
| pallets/jinja | pytest | recorded | 24 | 4 of 6 | 0 | 31% |
| apache/commons-codec | Maven | recorded (JaCoCo) | 90 | 4 of 4 | 0 | 10% |
Zero misses in all nine runs. The recorded tier is where the savings are: on commons-codec a change typically runs a tenth of the suite. The static tier is more cautious, since an import graph cannot tell which tests a shared module really affects.
The samples are small, a handful of mutations per repository, and several runners have been benched on a single repository only. Treat the stable runners as ready for pull-request use alongside a scheduled full run, the beta and experimental ones as something to try and report on. The soundness page and limits list what has and has not been checked.
What is next
Section titled “What is next”Wider benching (more repositories per runner, the Bun and Deno recorded tiers, Playwright recorded), more runners, and whatever you find. If trimtest skips a test it should have run, that is the most useful bug report there is: open an issue with the diff and the test it missed.
trimtest is free and Apache-2.0. If it saves your CI time, you can support it.