The recorded dependency map and the rules that keep it honest.
For each test file the map stores the source files it executed and one
fingerprint: the content hash of the test file and of every one of those
sources. A test file is stale when it has no entry or when its fingerprint
no longer matches the files on disk, so the map validates itself and needs
no help from git.
A separate globals fingerprint covers what a per-test map cannot see:
dependencies, configuration, migrations, test_helper.exs and any file that
defines macros. When it changes, every test file is stale.
Summary
Functions
Test files whose recorded sources include any of the changed paths.
Forgets a test file, which makes it stale until it is recorded again.
The fingerprint of everything the per-test map cannot see.
An empty map stamped with the current globals.
What a local run has to execute: {:all, reason} when the globals moved,
otherwise {:run, stale_test_files}.
Drops the entries of test files that no longer exist on disk.
Stores the sources a test file executed, fingerprinted against the disk.
Reads a map, or :error when it is missing, unreadable or of another version.
What CI has to execute for a diff: the stale test files plus every test file whose recorded sources include a changed path.
Test files on disk that have no entry or whose fingerprint no longer matches.
Every test file on disk.
Writes the map with one test file per line, so concurrent edits merge cleanly.
Types
Functions
Test files whose recorded sources include any of the changed paths.
Forgets a test file, which makes it stale until it is recorded again.
@spec globals(Tia.Config.t()) :: String.t()
The fingerprint of everything the per-test map cannot see.
@spec new(Tia.Config.t()) :: t()
An empty map stamped with the current globals.
@spec plan(t(), Tia.Config.t()) :: selection()
What a local run has to execute: {:all, reason} when the globals moved,
otherwise {:run, stale_test_files}.
@spec prune(t(), Tia.Config.t()) :: t()
Drops the entries of test files that no longer exist on disk.
@spec put(t(), Tia.Config.t(), String.t(), [String.t()]) :: t()
Stores the sources a test file executed, fingerprinted against the disk.
Reads a map, or :error when it is missing, unreadable or of another version.
@spec select(t(), [String.t()], Tia.Config.t()) :: selection()
What CI has to execute for a diff: the stale test files plus every test file whose recorded sources include a changed path.
@spec stale(t(), Tia.Config.t()) :: [String.t()]
Test files on disk that have no entry or whose fingerprint no longer matches.
@spec test_files(Tia.Config.t()) :: [String.t()]
Every test file on disk.
Writes the map with one test file per line, so concurrent edits merge cleanly.