CodeVetter · Repo Unpack · Data flow
avajs/ava
Configuration and CLI input become normalized project-relative selectors and transferable worker options. The parent owns file scheduling and run statistics, while each worker owns test execution and assertion state. Structured state events return through thread messaging or child-process IPC to reporters and exit-code logic. Snapshot and scheduling writes feed touched-file events back into watch mode.
- loadConfig() derives projectDir from package configuration, searches config modules up to the repository boundary, and rejects implicit package/file conflicts; an explicit config discards package configuration.
- CLI flags overwrite corresponding configured values; file arguments are resolved from cwd, made relative to projectDir, and split into patterns and line selections.
- findTests() expands globs into absolute paths, filters extensions, and excludes underscore-prefixed files; CLI filtering can additionally select existing files outside discovered matches.
- Provider main.compile() receives all discovered tests; non-null provider state is sent to workers, while provider objects and sortTestFiles functions are removed from transferable options.
- Worker setup installs provider loaders, loads configured modules sequentially, awaits their default functions with arguments, then imports the test file.
- Declaration arguments become metadata-bearing task records; each test gets ContextRef.copy(), whose first access shallow-copies an object value.
- Worker Runner events cross the channel into loadFork(), which attaches testFile; RunStatus updates per-file/global counters and emits copied statistics to reporter subscribers.
- Snapshot assertions map values to title/index entries and Concordance descriptors; saving emits changed/temporary paths, which watch mode records to suppress self-generated reruns.