Propagation depth
This is the central setting. For each file you decide how far the run propagates through the reverse graph, meaning through the files that import it.
| Value | Hops | Meaning |
|---|---|---|
"self" | 0 | only the tests of the changed file |
"direct" | 1 | the file plus whoever imports it directly (default) |
"transitive" | ∞ | the file plus the whole chain of importers |
n | n | an exact numeric depth |
Try it
Pick a depth and see, right now, what would happen when login.ts is saved. This runs the same breadth-first search the daemon runs.
The rule that produces this
Notice that self still runs a test. Propagation walks import edges; mapping a source file to its test file happens afterwards, by naming convention. Collapsing the two stages would make self run nothing at all, because the test sits one hop away from the source.
Configuring it
{
"dependencyDepth": {
"default": "direct",
"overrides": {
"src/util/**": "self", // stable utility: does not propagate
"src/components/Login.tsx": "transitive" // critical: propagates all the way
}
}
}Overrides are evaluated in declaration order, and the last match wins, which lets you write a broad rule followed by exceptions:
"overrides": {
"src/**": "self", // general rule
"src/components/Login.tsx": "transitive" // exception
}Choosing a value
Too many tests running (slow). A file imported by half the project, like a types module or a constants file, drags the whole suite along on every save. Pin it to "self".
Too few tests running (regressions slip through). A file whose breakage shows up only in its consumers, typically authentication, routing or serialization, deserves "transitive".
Not sure. Leave "direct". It is the default because it catches the common case, the importer that broke, without paying for the full chain.
Checking before you commit to it
$ npx livetest why src/login.tsfile: src/login.ts
runner: js
depth: transitive, file plus the full chain of importers [override: src/login.ts]
impacted files (8):
[0] src/login.ts
[1] src/header.ts
[2] src/layout.ts via src/header.ts
...You can also try a depth without editing the config file:
npx livetest run src/login.ts --depth transitive
npx livetest why src/login.ts --depth selfThe graph is not omniscient
Dynamic imports with a computed expression, dependency injection and reflection do not appear in the graph. livetest why warns about the specifiers it could not resolve. In those files, consider a larger depth or run the full suite before concluding all is well.