Discovers, plans, and runs project tests according to Bau configuration.
Types
TestCase = object path*: string ## Absolute path to the Nim test file. runner*: bool ## True when this file is acting as an aggregate runner.
- One runner or test file selected for execution.
TestInvocationTiming = object profile*: string ## Display profile name. path*: string ## Project-relative test path. cached*: bool ## True when compilation was skipped. compileMs*: int64 ## Milliseconds spent compiling. runMs*: int64 ## Milliseconds spent running. totalMs*: int64 ## Compile plus run milliseconds. passed*: bool ## True when compile and run both succeeded.
- Timing data for one profile/file invocation.
TestOutputMode = enum tomAuto = "auto", ## Stream configured runners, capture small test files. tomAlways = "always", ## Stream all test process output live. tomNever = "never" ## Capture output and print only Bau summaries.
- How test process output is shown.
TestRunOptions = object profile*: string ## Requested profile when no test matrix is configured. profileExplicit*: bool ## Whether the profile came from CLI input. filter*: string ## Optional filename/path substring filter. changed*: bool ## Whether to limit to affected test files. since*: string ## Git ref used for changed-test detection. passthroughArgs*: seq[string] ## Arguments passed to test programs. showOutput*: TestOutputMode ## Output capture/streaming policy. verbose*: bool ## Whether captured successful output is printed. dryRun*: bool ## Print planned invocations without executing them. jobs*: int ## Maximum test file invocations to run at once. jobsExplicit*: bool ## Whether jobs came from CLI input. timings*: bool ## Whether per-test timings should be printed. noMatrix*: bool ## Force one profile instead of the configured matrix. full*: bool ## Force the full configured test matrix. fast*: bool ## Use the fast local test mode. noRunner*: bool ## Discover test files instead of using a runner. featureSelection*: FeatureSelection ## Enabled feature set.
- Options controlling a bau test run.
TestRunResult = object planned*: int ## Number of planned profile/file invocations. passed*: int ## Number of passed profile/file invocations. failed*: int ## Number of failed profile/file invocations. timings*: seq[TestInvocationTiming] ## Per-invocation timing details.
- Aggregate test result counters.
Procs
proc collectTestCases(cfg: BauConfig; projectDir: string; opts: TestRunOptions): seq[ TestCase] {....raises: [OSError, ValueError, IOError, KeyError], tags: [ ReadDirEffect, RootEffect, ReadIOEffect, WriteDirEffect, ExecIOEffect, ReadEnvEffect, TimeEffect], forbids: [].}
- Return runner or individual test files selected for a test run.
proc effectiveTestOutputMode(cfg: BauConfig; override: string): TestOutputMode {. ...raises: [ValueError], tags: [], forbids: [].}
- Return the effective test output mode from CLI or [test].
proc effectiveTestProfiles(cfg: BauConfig; requestedProfile: string; useConfiguredProfiles = true; profileExplicit = false; noMatrix = false; full = false; fast = false): seq[string] {. ...raises: [], tags: [], forbids: [].}
- Return the profile matrix used by a test run.
proc parseTestOutputMode(value: string): TestOutputMode {....raises: [ValueError], tags: [], forbids: [].}
- Parse a user-facing test output mode string.
proc runTests(cfg: BauConfig; projectDir: string; opts: TestRunOptions; useConfiguredProfiles = true): TestRunResult {. ...raises: [OSError, ValueError, IOError, KeyError], tags: [ReadDirEffect, RootEffect, ReadIOEffect, WriteDirEffect, ExecIOEffect, ReadEnvEffect, TimeEffect, WriteIOEffect], forbids: [].}
- Run selected tests and return aggregate counters.