JSON and machine-readable output
select --json
Section titled “select --json”trimtest select --json{ "baseline": "map e6161e595f", "changed": ["tests/test_a.py", "util.py"], "unobserved": [], "adapters": [ { "adapter": "pytest", "full": null, "total_tests": 1, "selected": [ { "test": "tests/test_a.py", "reason": "test changed", "rank": 1, "reasons": ["test changed", "util.py -> tests/test_a.py"], "tier": "static" } ] } ]}| Field | Meaning |
|---|---|
baseline |
what the change was measured against: map <id> for a recorded baseline, or the git ref with --base |
changed |
files that changed since the baseline |
unobserved |
changed files no test is known to reach |
adapters[].adapter |
the runner adapter, such as pytest, vitest, cargo, maven |
adapters[].full |
null, or the reason the whole project was selected |
adapters[].total_tests |
how many tests the project tracks |
adapters[].selected[].test |
the test file |
adapters[].selected[].reason |
the primary reason |
adapters[].selected[].reasons |
every reason; trimtest explain prints these |
adapters[].selected[].rank |
run order; lower runs first (failed last run is 0) |
adapters[].selected[].tier |
static, recorded, rule or full |
Fields may be added in later versions; do not rely on their absence.
select --paths
Section titled “select --paths”One selected test path per line, for scripting:
trimtest select --paths | xargs -n1 echoselect --format github
Section titled “select --format github”Appends these to $GITHUB_OUTPUT (and prints them when it is unset):
any=truecount=1matrix={"include":[{"adapter":"pytest","command":"python3 -m pytest tests/test_a.py","cwd":"."}]}any is true when something would run, count is the number of tests (the whole project’s count for a full
run), and matrix has one entry per runner command. Projects with no tests are left out.
explain
Section titled “explain”trimtest explain tests/test_a.pytests/test_a.py was SELECTED by pytest (static evidence): - test changed - util.py -> tests/test_a.pyPass a source file instead of a test to see which tests it reaches.