git tpl test¶
Run a local template's declared test cases and report their results.
Cases live in the template repository's tests/ directory by default.
Use the testing guide to build and maintain a suite;
the case reference defines assertions, commands, migrations, and snapshots.
Input revision¶
Without --ref, cases, snapshots, and template files come from the working tree, including uncommitted changes.
With --ref, all three come from that committed revision.
--template accepts a local checkout only, never a remote source.
There is no render-root override.
Options¶
| Flag | Effect |
|---|---|
[CASE]... |
Run named cases; tests/minimal.toml is named minimal, not its path. |
--template PATH |
Local template checkout; defaults to the current directory. |
--tests PATH |
Case directory instead of tests. |
--ref REF |
Test a committed branch, tag, or commit instead of the working tree. |
--write |
Record snapshots only for cases declaring snapshot = true; run no commands or assertions. |
--skip-commands |
Disable every case's external command lists for this invocation. |
--shard INDEX/TOTAL |
Run a deterministic balanced subset of selected cases; indices start at 1. |
--record-durations |
Run cases and record timings for future balanced shards. |
There is no --answer, --answers-from, or --defaults: the case file owns its answer set.
Unknown answer keys always fail a case.
--record-durations conflicts with --shard and --write.
Shards split evenly by count when no selected case has a positive recorded duration.
Execution and trust¶
Running test consents to the case's declared commands in a disposable sandbox.
--skip-commands or tpl.testCommands = false disables those commands;
the flag cannot re-enable commands disabled by configuration.
Rendering and init cannot invoke these commands.
A case's trust controls declared data-source access and defaults to true.
Remote inheritance ancestors instead require persistent authorization before case discovery;
there is no invocation-wide --trust flag.
See case trust.
--write writes snapshot files into the template checkout, unstaged.
It never runs case commands or checks expectations, so run plain git tpl test afterward.
Migration cases still execute their declarative upgrade when recording.
Progress and results¶
Progress goes to stderr; --quiet and --json suppress it.
--verbose streams case command output live.
GitHub Actions receives grouped progress and failure annotations automatically.
Exit status is 0 when all selected cases pass and 1 for failed cases or a run that could not start.
Under --json, ok: true means the command ran; inspect summary.failed to determine whether the suite passed.
See the JSON contract for payload fields.