Running the full test suite for a one-line change wastes time; skipping tests risks breakage. vg tests finds the minimal, correct set of tests for the code you touched. This article covers mapping tests to code, finding gaps with --missing, and running the right tests with --run and --exec.
Overview
vg tests shows which tests cover a given node — linked by call relationships or coverage data in the code map. From there you can find untested code nearby, print the exact command to exercise just those tests, or run it directly.
Prerequisites
Build a code map first:
vg build
See which tests cover a node
vg tests
The output lists the tests linked to the node so you know exactly what exercises it.
Find coverage gaps
To surface untested nodes near the one you are looking at:
vg tests --missing
This highlights code that nothing currently tests — the gaps most worth filling before you ship. See tests coverage gaps for how to act on these.
Run only the tests that matter
Print the minimal command to exercise exactly the relevant tests:
vg tests --run
Or run that command directly:
vg tests --exec
This lets you validate a change with a tightly scoped run instead of the whole suite — fast feedback without sacrificing confidence.
Tying tests to blast radius
vg tests pairs naturally with impact analysis. When you ask what a change could break, you can also surface exactly the tests to run before shipping:
vg impact
Related
- Estimate blast radius with
vg impact. - Inspect a node with
vg show. - Read tests coverage gaps for a deeper guide.
Test mapping is computed from the local code map and stays on your machine.