Skip to main content

Module collection

Module collection 

Source
Expand description

Which test files a run actually collected: a test that never ran is evidence of nothing.

Pure: the runtime reads manifests and configuration, runs listings, and hands their facts here. Per toolchain this module knows the static collection rule (what proves a file is not collected), how a test id in a JUnit report or a listing maps back to a file, the markers that make a file define tests, and the one-sentence rule and fixes a person and the retry read.

Structs§

Collection
The attempt’s changed test files and whether the run collected them.
CollectionRule
A runner’s collection rule: one sentence a person reads, and where it came from.
FileCollection
One judged test file.
JsRule
A JS runner’s include rule, when it is known statically.
ListingRun
A listing speccoder ran because the earlier sources left a file undecided.
ModDecl
A mod declaration found in a source file.
PytestRule
pytest’s collection settings, as configured or by default.
RustPackage
One Cargo package, as its manifest says.
RustTarget
A compiled test binary and its crate root.

Enums§

DecidedBy
What decided a file’s state.
FileState
Whether the run collected a test from a file.
JsRunner
The JS runners.
Toolchain
A test toolchain speccoder knows how to ask.

Constants§

COMPILED_OUT
The reason for a file reachable by the rule whose tests did not run.
GO_RULE
The Go rule sentence.
REASON_PREFIX
The prefix of every verdict reason a never-run file gives.
RUST_RULE
The Rust rule sentence.

Functions§

collected
A decided file, built from parts.
declared_tests
How many tests source declares by the toolchain’s markers (a lower bound for what a run of it must collect).
defines_tests
Whether source defines at least one test by the toolchain’s markers: a helper without test definitions is never judged.
glob_match
Whether path matches a glob: **, *, ?, […], {a,b} and the extglobs ?(…), @(…), +(…), *(…) (vitest and jest defaults use them).
go_breaks
Why a Go test file is never run by the static rule, if it is not, with the fixes. tags: the build tags the check sets.
go_build_constraint
The file’s //go:build expression, when it has one.
go_build_satisfied
Evaluates a //go:build expression with tags set (plus the OS, architecture, unix and release tags go1.N, which are always on).
go_declared_tests
The test functions go test runs from a file: Test, Example, Fuzz followed by end or a non-lowercase character.
go_id_matches
A Go test id’s match: JUnit importpath::TestX or a listing name, for a file whose package is import_path and that declares names.
go_rule
The Go rule.
is_build_or_dependency
Directories nothing judges: build output and dependencies.
join
Joins dir and rel and normalises ./..; None when the result leaves the workspace root.
match_name
fnmatch over one path segment: *, ?, […].
not_collected
A file no test ran from.
python_id_matches
A pytest id’s file: tests/test_x.py::test_a (listing) or the JUnit classname::name form tests.test_x::test_a / tests.test_x.TestC::t.
reason
tests not collected: `<path>` — <rule>; <why>.
retry_line
`<path>` never ran: <short rule>. <Fixes>. — the retry digest’s line.
rust_fixes
The ways out for an unreachable Rust file.
rust_mod_decls
The mod declarations of a Rust source file (comments ignored), file modules (mod x;) only, each with the inline modules around it.
rust_reachable
Where each file reachable from targets sits: the targets’ binary ids with the file’s module path ("" for a crate root). read gives a file’s text (workspace-relative path); a file it cannot read ends the walk there. #[path] is followed; a path leaving the root is ignored.
rust_rule
The Rust rule as configured: autotests = false leaves only [[test]] targets.
rust_targets
The test-carrying targets of pkg, from its manifest and the files present (files: workspace-relative paths).
rust_tests_by_file
Which file each test id belongs to: the longest binary id that prefixes it, then the longest module path of a file of that binary. files: path → (binary id, module path) as rust_reachable gives them.
strip_comments
Strips // and /* */ comments, keeping line breaks (strings are left as they are: a comment marker inside one is rare and only hides text).
toolchain_of
The toolchain a file’s extension belongs to.
unknown
A file speccoder cannot tell about.