Tests.Runner

Module tests.runner

import tests.runner

Finding the tests, then executing them.

The runner finds tests through reflect: it walks the modules of the running package, reads the functions carrying @tests.Test, and builds a tests.TestCase for each.

discover and its siblings only find; exec runs what it is given and emits a tests.TestEvent as each test starts and finishes, which is what a reporter subscribes to. runT is the two put together with TAP output, and is what a Cavefile test task normally calls.

@tests.Only is applied here rather than at discovery: if any discovered test carries it, the run narrows to those.

Dependencies


Contents


Functions

discover

`tests/runner/runner.zirr:85`
fn discover(module: AnyModule) -> [tests.TestCase]

Every @tests.Test function declared in module, as runnable cases.


discoverAll

`tests/runner/runner.zirr:99`
fn discoverAll(modules: [AnyModule]) -> [tests.TestCase]

Every @tests.Test function declared in any of modules, as runnable cases.


discoverWhere

`tests/runner/runner.zirr:111`
fn discoverWhere(predicate: fn(String) -> Bool) -> [tests.TestCase]

Every @tests.Test function declared in a project module whose name satisfies predicate.
Only the modules the predicate accepts are loaded, so the rest never run.


exec

`tests/runner/runner.zirr:15`
fn exec(discovered: [tests.TestCase], onEvent: fn(tests.TestEvent)) -> tests.TestReport

Runs test cases, emitting events, and returns a report.
This is the primitive the entry points below build on: it executes exactly the cases it is given and neither discovers nor reports anything itself.


runT

`tests/runner/runner.zirr:148`
fn runT() -> tests.TestReport

Runs every test in the project modules whose name ends with “_t”, the convention this repository follows.
Both a foo/_t submodule and a sibling module named foo_t match.


runWhere

`tests/runner/runner.zirr:138`
fn runWhere(predicate: fn(String) -> Bool) -> tests.TestReport

Runs every test in the project modules whose name satisfies predicate, reporting TAP to stdout.
Exits with a non-zero status when any test failed, so a task or CI step fails with the suite.


Constants

ignoreEvents

`tests/runner/runner.zirr:11`
const ignoreEvents

An event callback that discards everything, for runs without output.