Expand description
Test impact analysis: which test files a change can affect.
The graph links every file of the project to the files it uses, as far as they can be read from the source:
- in a script:
extends,preload/loadand any other"res://…"or"uid://…"string, theclass_nameof another script used by name, and an autoload used by name; - in a scene or text resource (
.tscn,.tres): itsext_resources.
A test file is affected by a change when it reaches a changed file through these links. What the source cannot tell is handled cautiously:
- a script that loads a computed path (
load(path)) may load any file, so the tests that reach it always run; with a known folder (load("res://items/" + id)), it depends on every file of that folder; project.godot, the autoloads and the test runner’s own files change what every test runs with, so a change to one of them affects every test.
What the tests did when they last ran adds to that, as Vitest learns a
test’s dynamic imports by running it: the worker reports the scenes and
scripts of the nodes each test added to the tree, and record_uses
keeps them per test file. A test file uses what it was seen to use, and
once seen, a computed load() it reaches no longer makes it run on every
change.
Structs§
Enums§
- Impact
- Which test files a change affects.
Functions§
- affected_
files - Every file that uses one of
changed, directly or not, without the changed files themselves. - build_
dep_ graph - Forward and reverse graphs of the project. See
Graph::build. - parse_
file_ deps - The
res://paths a script names inextends,preloadandload. Kept for callers of the first version;parse_scriptreads more. - parse_
script - Reads what a script uses.
- parse_
text_ resource - Reads what a scene or text resource uses: its
ext_resources. - read_
uses - What each test file was seen to use: test file → res:// paths.
- record_
uses - Adds what the test files of a run used to what was seen before. Kept across runs, so a test that loads different scenes on different runs depends on all of them.
- uses_
path - Where gdtest keeps what each test file used when it last ran.
Type Aliases§
- DepGraph
- Maps res:// path → set of res:// paths.