# avajs/ava — codebase unpack

> Canonical page: https://codevetter.com/unpack/ava

This is a deterministic Repo Unpack scan of avajs/ava — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: bbfd946322fdeca2b547a691d947fb4e18c0c67f (2026-05-17)
- Last upstream commit: v8.0.1
- Generated by codevetter 1.15.0 on 2026-10-02
- 935 files scanned · 965 KB

Source inspection; upstream code and tests were not executed.

## Languages

- JavaScript: 489 files
- JSON: 165 files
- Markdown: 109 files
- TypeScript: 37 files
- YAML: 3 files
- Shell: 2 files

## Repository structure

- test/ — 460 files
- test-tap/ — 301 files
- lib/ — 51 files
- examples/ — 33 files
- docs/ — 28 files
- test-types/ — 14 files
- media/ — 11 files
- .github/ — 7 files

Probable source entrypoint: `lib/` (inferred from the tree, not upstream docs)

## Package

- package.json: ava v8.0.1 — 55 declared dependencies

## Structural health signals

Average score 8.6/10 across 96 files; 1 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- bbfd946322fd (2026-05-17) v8.0.1
- 332fcd7cf9db (2026-05-17) Pre-release updates (#3451)
- fcaaf432e3c1 (2026-05-16) Add Node.js 26 support; drop 25 (#3450)
- a91380449671 (2026-05-14) Test using AVA 8 (#3440)
- fe3128673adf (2026-04-27) v8.0.0

## Overview

AVA 8.0.1 is an ESM Node.js test runner for developers who want explicit test declarations, concurrent execution, detailed assertion diagnostics, and snapshot testing. It coordinates isolated workers per test file, runs hooks and tests inside each worker, and reports structured results through terminal or TAP output. Its distinctive extension surfaces include reusable macros, a negotiated TypeScript provider, shared-worker plugins, and dependency-aware watch mode.

## System map

AVA separates CLI orchestration from per-file test execution. The parent process discovers files, prepares providers, schedules workers, and aggregates events; workers own declarations, assertions, hooks, and snapshot state. Persistent artifacts are filesystem snapshots and local scheduling caches. Distribution is an npm package with a manually dispatched release workflow.
- package.json exposes the ava executable through entrypoints/cli.js, declares ESM, and supports Node ^22.20, ^24.12, or >=26. — [package.json#L11-L30](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/package.json#L11-L30) [entrypoints/cli.js#L1-L4](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/cli.js#L1-L4)
- The public test entrypoint exports lib/worker/main.js, which checks runnerChain, marks loadedMain, and returns the worker's declaration chain. — [entrypoints/main.js#L1-L2](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/main.js#L1-L2) [lib/worker/main.js#L1-L11](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/main.js#L1-L11)
- loadCli() loads configuration, normalizes providers and selection options, constructs Api, and chooses a reporter before entering one-shot or watch execution. — [lib/cli.js#L95-L111](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L95-L111) [lib/cli.js#L336-L432](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L336-L432) [lib/cli.js#L434-L452](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L434-L452)
- Api.run() discovers tests, applies selection and CI partitioning, compiles providers, and schedules selected files with pMap. — [lib/api.js#L149-L198](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L149-L198) [lib/api.js#L240-L263](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L240-L263)
- loadFork() creates either a Worker with workerData or a childProcess.fork with advanced serialization; both forward stdout, stderr, and AVA state messages. — [lib/fork.js#L18-L54](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L18-L54) [lib/fork.js#L79-L134](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L79-L134)
- Runner owns per-file task queues and active runnables; Test owns each runnable's assertions, completion, and teardown. — [lib/runner.js#L41-L58](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L41-L58) [lib/runner.js#L278-L303](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L278-L303) [lib/test.js#L199-L212](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L199-L212) [lib/test.js#L624-L659](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L624-L659)
- Snapshot Manager persists binary snapshots and Markdown reports; scheduler separately stores failing-tests.json in the AVA cache outside CI. — [lib/snapshot-manager.js#L385-L417](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L385-L417) [lib/scheduler.js#L8-L31](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/scheduler.js#L8-L31)
- npm test invokes lint, TypeScript checking, both test suites, and c8 reporting; release.yml validates a supplied ref, publishes npm provenance, and creates a draft GitHub release. — [package.json#L32-L39](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/package.json#L32-L39) [scripts/test.sh#L1-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/test.sh#L1-L8) [.github/workflows/release.yml#L29-L88](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/workflows/release.yml#L29-L88) [.github/workflows/release.yml#L186-L197](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/workflows/release.yml#L186-L197)

## Feature catalog

AVA's user surface combines CLI selection and execution controls with an explicit test API. Tests support modifiers, hooks, macros, asynchronous completion, execution context, and assertions. Snapshot updates, watch interactions, debugging, TAP output, and TypeScript integration extend the development workflow. Shared-worker plugins provide coordination across otherwise isolated test files.
- The default CLI command accepts patterns, directories, and paths with line-number suffixes; --match filters titles, while --serial, --concurrency, --fail-fast, and --no-worker-threads control execution. — [lib/cli.js#L30-L62](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L30-L62) [lib/cli.js#L164-L173](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L164-L173) [lib/cli.js#L399-L405](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L399-L405)
- ava debug selects one file and exposes inspector host, port, and break options; ava reset-cache removes entries beneath the project's AVA cache and exits. — [lib/cli.js#L174-L215](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L174-L215) [lib/cli.js#L257-L284](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L257-L284)
- createChain() implements serial, only, skip, failing, todo, skipIf(), and runIf(), plus before/beforeEach/after/afterEach hooks and after-hook always modifiers. — [lib/create-chain.js#L101-L159](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/create-chain.js#L101-L159)
- test.macro() freezes exec/title definitions; parseTestArgs() accepts macro arguments, generates titles, and normalizes title whitespace. — [lib/create-chain.js#L162-L168](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/create-chain.js#L162-L168) [lib/parse-test-args.js#L1-L25](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/parse-test-args.js#L1-L25)
- ExecutionContext supplies log(), plan(), timeout()/timeout.clear(), teardown(), context access, and t.try() results with explicit commit/discard operations. — [lib/test.js#L68-L99](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L68-L99) [lib/test.js#L124-L175](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L124-L175) [lib/test.js#L185-L190](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L185-L190)
- Assertions include identity and deep comparisons, sync/async exception expectations, snapshots, truth tests, and regex checks; snapshot assertions are prohibited in hooks. — [lib/assert.js#L293-L359](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/assert.js#L293-L359) [lib/assert.js#L398-L460](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/assert.js#L398-L460) [lib/assert.js#L634-L639](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/assert.js#L634-L639) [lib/assert.js#L687-L809](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/assert.js#L687-L809)
- Watch mode supports reruns, snapshot updates, glob and title prompts, and dependency-based file selection; CLI watch mode is rejected in CI and during debugging. — [lib/watcher.js#L358-L395](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L358-L395) [lib/watcher.js#L529-L548](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L529-L548) [test/watch-mode/basic-functionality.js#L5-L17](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/watch-mode/basic-functionality.js#L5-L17) [lib/cli.js#L288-L299](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L288-L299)
- AVA offers terminal/TAP reporting, an optional @ava/typescript provider, and ava/plugin shared workers with publish/subscribe messaging; shared workers require worker threads. — [lib/cli.js#L336-L349](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L336-L349) [lib/cli.js#L434-L452](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L434-L452) [lib/worker/plugin.js#L68-L99](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/plugin.js#L68-L99) [entrypoints/plugin.js#L1-L1](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/plugin.js#L1-L1)

## Data flow

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. — [lib/load-config.js#L77-L86](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L77-L86) [lib/load-config.js#L108-L156](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L108-L156)
- CLI flags overwrite corresponding configured values; file arguments are resolved from cwd, made relative to projectDir, and split into patterns and line selections. — [lib/cli.js#L221-L237](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L221-L237) [lib/cli.js#L397-L405](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L397-L405)
- findTests() expands globs into absolute paths, filters extensions, and excludes underscore-prefixed files; CLI filtering can additionally select existing files outside discovered matches. — [lib/globs.js#L96-L127](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L96-L127) [lib/globs.js#L188-L219](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L188-L219)
- 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. — [lib/api.js#L240-L246](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L240-L246) [lib/api.js#L270-L279](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L270-L279)
- Worker setup installs provider loaders, loads configured modules sequentially, awaits their default functions with arguments, then imports the test file. — [lib/worker/base.js#L153-L195](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L153-L195) [lib/worker/base.js#L207-L228](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L207-L228)
- Declaration arguments become metadata-bearing task records; each test gets ContextRef.copy(), whose first access shallow-copies an object value. — [lib/runner.js#L100-L177](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L100-L177) [lib/runner.js#L498-L515](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L498-L515) [lib/context-ref.js#L14-L38](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/context-ref.js#L14-L38)
- Worker Runner events cross the channel into loadFork(), which attaches testFile; RunStatus updates per-file/global counters and emits copied statistics to reporter subscribers. — [lib/worker/base.js#L94-L95](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L94-L95) [lib/fork.js#L66-L70](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L66-L70) [lib/run-status.js#L46-L79](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/run-status.js#L46-L79) [lib/run-status.js#L213-L217](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/run-status.js#L213-L217)
- 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. — [lib/test.js#L219-L238](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L219-L238) [lib/snapshot-manager.js#L291-L319](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L291-L319) [lib/worker/base.js#L102-L107](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L102-L107) [lib/watcher.js#L240-L247](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L240-L247)

## Behavior traces

Source inspection followed startup, test execution, and snapshot persistence end-to-end, with additional traces for reporting, failures, scheduling, and watch reruns. These are execution-order descriptions from code rather than observed runs. Material conditions include selection, hook failures, CI snapshot policy, and worker shutdown handshakes.
- Startup: entrypoints/cli.js calls loadCli() → loadConfig() → option normalization → new Api() → reporter construction → api.run({filter}); one-shot completion sets process.exitCode and calls reporter.endRun(). — [entrypoints/cli.js#L1-L4](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/cli.js#L1-L4) [lib/cli.js#L95-L105](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L95-L105) [lib/cli.js#L407-L452](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L407-L452) [lib/cli.js#L526-L534](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L526-L534)
- File launch: Api.run() → globs.findTests()/applyTestFileFilter() → scheduler.failingTestsFirst() → provider compile() → pMap() → fork(); serial mode uses one file worker and automatic CI concurrency uses two. — [lib/api.js#L149-L198](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L149-L198) [lib/api.js#L240-L258](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L240-L258) [lib/api.js#L263-L286](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L263-L286)
- Worker bootstrap: run(options) constructs Runner and publishes runnerChain → installs providers → loads setup modules → loads testPath; importing ava marks loadedMain, otherwise the worker reports missing-ava-import and exits. — [lib/worker/base.js#L54-L88](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L54-L88) [lib/worker/base.js#L153-L172](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L153-L172) [lib/worker/base.js#L207-L238](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L207-L238) [lib/worker/main.js#L7-L11](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/main.js#L7-L11)
- Primary test action: chain registration schedules Runner.start() on nextTick → readiness wait → before hooks → serial tests → concurrent tests; runTest() executes beforeEach, Test.run(), success-only afterEach, and afterEach.always. — [lib/runner.js#L87-L98](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L87-L98) [lib/runner.js#L327-L403](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L327-L403) [lib/runner.js#L467-L515](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L467-L515)
- Runnable completion: Test.run() calls the implementation and awaits a returned promise or observable → finish() clears timeout, verifies plan/assertions, awaits reverse-order teardowns, and inverts the result for failing tests. — [lib/test.js#L480-L489](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L480-L489) [lib/test.js#L530-L578](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L530-L578) [lib/test.js#L599-L646](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L599-L646)
- Snapshot persistence: t.snapshot() → Test.compareWithSnapshot() → Runner.compareTestSnapshot() → Manager.compare()/record(); Runner finish triggers saveSnapshotState(), which encodes and atomically writes .snap/.md files before worker-finished. — [lib/assert.js#L650-L672](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/assert.js#L650-L672) [lib/test.js#L221-L238](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/test.js#L221-L238) [lib/runner.js#L216-L225](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L216-L225) [lib/worker/base.js#L102-L122](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L102-L122)
- Run closure: workers send worker-finished → parent sends free-worker → worker checks unhandled rejections and schedules completion handlers; parent waits for worker/shared-worker cleanup, stores failed-file state, and ends RunStatus. — [lib/fork.js#L106-L109](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L106-L109) [lib/worker/base.js#L122-L141](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L122-L141) [lib/worker/completion-handlers.js#L5-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/completion-handlers.js#L5-L8) [lib/api.js#L301-L315](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L301-L315)
- Watch rerun: recursive fs.watch() marks dirty paths → debounce waits for tracing and filters touched files → traceToTestFile() selects dependents or unknown changes trigger all tests → plan() yields options → start() calls Api.run() and ends reporting. — [lib/watcher.js#L159-L171](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L159-L171) [lib/watcher.js#L426-L443](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L426-L443) [lib/watcher.js#L529-L585](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L529-L585) [lib/watcher.js#L721-L744](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L721-L744)

## Testing signals

Tests and CI were inspected, not executed; no passing results or measured coverage are asserted. AVA uses @ava/test for runtime integration tests, TAP for internal suites, and TypeScript compilation for declaration cases. Inspected coverage includes configuration, worker selection, snapshots, scheduling, watch interactions, and shared-worker lifecycle. The inventory is bounded, and CI contains explicit platform and concurrency accommodations.
- The inspected npm test script runs XO, tsc --noEmit, @ava/test's test-ava command, TAP, and c8 reporting; these commands were read but not executed. — [scripts/test.sh#L1-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/test.sh#L1-L8) [package.json#L118-L132](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/package.json#L118-L132)
- ava.config.js selects test files while excluding fixtures/helpers; .taprc separately includes TAP unit, reporter, and integration files with a 300-second timeout. — [ava.config.js#L3-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/ava.config.js#L3-L12) [.taprc#L1-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.taprc#L1-L8)
- Integration helpers launch the real CLI through execaNode, set TEST_AVA and TEST_AVA_IMPORT_FROM, capture output, and consume IPC results; worker tests cover default threads and both child-process selection mechanisms. — [test/helpers/exec.js#L79-L118](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/helpers/exec.js#L79-L118) [test/worker-threads/test.js#L1-L18](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/worker-threads/test.js#L1-L18)
- Configuration tests exercise package settings, explicit overrides, conflicts, factory returns, defaults, and wrapped errors; TAP Runner cases exercise synchronous declarations and emitted events. — [test/config/loader.js#L50-L110](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/config/loader.js#L50-L110) [test-tap/runner.js#L17-L77](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test-tap/runner.js#L17-L77)
- Snapshot selection tests specify preservation of skipped snapshots/tests and targeted updates by title or lines; scheduler tests specify failure-first ordering and disabled-cache behavior. — [test/snapshot-workflow/selection.js#L7-L65](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/snapshot-workflow/selection.js#L7-L65) [test/scheduler/test.js#L15-L48](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/scheduler/test.js#L15-L48)
- Watch tests exercise instructions, SIGINT, reruns, and snapshot updates, with a Windows output-capture fallback; shared-worker lifecycle tests check availability and teardown output. — [test/watch-mode/basic-functionality.js#L5-L82](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/watch-mode/basic-functionality.js#L5-L82) [test/shared-workers/lifecycle/test.js#L5-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/shared-workers/lifecycle/test.js#L5-L12)
- CI defines Node 22/24/26 jobs across Linux, Windows, and macOS, TypeScript 5.9/6.0 checks, lint and lockfile jobs; scripts/ci.sh runs watch tests serially and excludes two reporter suites outside Linux. — [.github/workflows/ci.yml#L15-L61](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/workflows/ci.yml#L15-L61) [.github/workflows/ci.yml#L63-L105](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/workflows/ci.yml#L63-L105) [scripts/ci.sh#L4-L17](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/ci.sh#L4-L17)
- Coverage configuration excludes entrypoints, examples, declarations, and tests; type cases are compile inputs, and shared-worker source explicitly identifies delayed messages after deregistration as difficult to test. — [.c8rc.json#L1-L14](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.c8rc.json#L1-L14) [tsconfig.json#L9-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/tsconfig.json#L9-L12) [test-types/module/conditional-chains.ts#L1-L14](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test-types/module/conditional-chains.ts#L1-L14) [lib/plugin-support/shared-worker-loader.js#L99-L106](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/plugin-support/shared-worker-loader.js#L99-L106)

## Risk map

The main security-sensitive boundaries are executable configuration, arbitrary test/setup imports, inherited worker environments, inspector access, IPC, and filesystem writes. These are source observations about a developer tool that executes project code, not confirmed vulnerabilities. Additional correctness concerns involve snapshot durability, dependency tracing limits, and an error-handling branch identified by inspection. No runtime reproduction or exhaustive security audit was performed.
- Configuration discovery imports ava.config.js/.mjs and invokes exported factories before test workers exist; automatic upward search means parent-directory configuration can execute in the CLI process. — [lib/load-config.js#L13-L26](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L13-L26) [lib/load-config.js#L108-L124](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L108-L124) [lib/load-config.js#L138-L146](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L138-L146)
- Both worker modes inherit process.env and apply configured overrides; worker isolation does not filter inherited environment values, and childProcess.fork launches Node with supplied execArgv. — [lib/fork.js#L22-L51](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L22-L51) [lib/environment-variables.js#L1-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/environment-variables.js#L1-L12)
- Setup modules and test paths execute via dynamic import or provider loaders; dependency setup resolution can write import-from-project.mjs under project node_modules even independently of provider cache selection. — [lib/worker/base.js#L164-L204](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L164-L204) [lib/worker/base.js#L207-L228](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L207-L228)
- Debug mode accepts a configurable inspector host and port and calls inspector.open(..., true); the CLI default host is 127.0.0.1 and debugging is rejected in CI. — [lib/cli.js#L182-L190](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L182-L190) [lib/cli.js#L302-L309](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L302-L309) [lib/worker/base.js#L215-L220](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L215-L220)
- Snapshot destinations incorporate source-map source paths or configured locations, while glob discovery follows symlinks; snapshot writes/deletions and temporary cache creation are filesystem boundaries that can extend beyond the checkout. — [lib/snapshot-manager.js#L421-L455](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L421-L455) [lib/snapshot-manager.js#L475-L484](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L475-L484) [lib/globs.js#L78-L94](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L78-L94) [lib/api.js#L327-L332](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L327-L332)
- Hypothesis: separate concurrent atomic writes for .snap and .md protect each file individually but can leave the pair inconsistent if one write fails; updating also deliberately discards snapshot decoding errors. (inferred) — [lib/snapshot-manager.js#L403-L413](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L403-L413) [lib/snapshot-manager.js#L515-L524](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L515-L524)
- Hypothesis: a rejection from globs.findTests() leaves testFiles undefined, after which selectionInsights reads testFiles.length before the later reporting try/catch; this may bypass intended internal-error reporting. (inferred) — [lib/api.js#L149-L176](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L149-L176) [lib/api.js#L310-L315](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L310-L315)
- Watch tracing intentionally ignores installed dependencies and non-exact file references, and config modules are not reloaded; observeRun's iterator additionally stops after the first run, with multi-run support marked TODO. — [lib/watcher.js#L814-L824](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/watcher.js#L814-L824) [lib/globs.js#L26-L31](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L26-L31) [lib/api-event-iterator.js#L1-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api-event-iterator.js#L1-L12)

## Extension points

AVA exposes several deliberate extension seams rather than one general plugin registry. User macros and setup modules customize test behavior, while providers customize loading and compilation. Shared-worker factories supply cross-file services through a versioned messaging protocol. CLI flags, declaration chains, reporters, and public types form coordinated internal extension surfaces.
- CLI options are centralized in FLAGS and yargs command definitions; adding an execution option also requires mapping it into combined configuration and Api constructor options. — [lib/cli.js#L30-L93](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L30-L93) [lib/cli.js#L164-L215](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L164-L215) [lib/cli.js#L221-L237](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L221-L237) [lib/cli.js#L407-L432](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L407-L432)
- createChain() uses a WeakMap registry and metadata flags to compose declaration APIs; macros are frozen exec/title records interpreted by parseTestArgs(). — [lib/create-chain.js#L1-L39](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/create-chain.js#L1-L39) [lib/create-chain.js#L121-L168](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/create-chain.js#L121-L168) [lib/parse-test-args.js#L17-L25](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/parse-test-args.js#L17-L25)
- Configuration may export an async factory receiving projectDir; require entries can name setup modules or argument tuples whose default functions are awaited before tests. — [lib/load-config.js#L142-L147](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L142-L147) [lib/api.js#L24-L31](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L24-L31) [lib/worker/base.js#L207-L213](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L207-L213)
- provider-manager imports a provider factory and negotiates ava-8; the negotiated interface supplies AVA version, projectDir, findFiles(), and glob normalization, with @ava/typescript as the registered provider. — [lib/provider-manager.js#L7-L54](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/provider-manager.js#L7-L54)
- Provider main hooks contribute extensions, update globs, and compile state; worker hooks expose canLoad()/load(), while watcher hooks interpret compilation changes. — [lib/extensions.js#L24-L26](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/extensions.js#L24-L26) [lib/globs.js#L71-L73](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L71-L73) [lib/api.js#L240-L246](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L240-L246) [lib/worker/base.js#L157-L179](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L157-L179)
- ava/plugin.registerSharedWorker() deduplicates registrations by filename and requires ava-4; its factory interface exposes readiness, broadcasts, subscriptions, connected test workers, and per-worker teardown. — [entrypoints/plugin.js#L1-L1](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/plugin.js#L1-L1) [lib/worker/plugin.js#L86-L127](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/plugin.js#L86-L127) [lib/plugin-support/shared-worker-loader.js#L175-L237](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/plugin-support/shared-worker-loader.js#L175-L237)
- Reporter classes consume plan.status stateChange events through startRun()/endRun(); experimental observeRun exposes an async event iterator only when observeRunsFromConfig is enabled. — [lib/reporters/default.js#L134-L153](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/reporters/default.js#L134-L153) [lib/reporters/tap.js#L67-L85](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/reporters/tap.js#L67-L85) [lib/cli.js#L465-L468](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L465-L468) [lib/load-config.js#L11-L11](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L11-L11)
- registerCompletionHandler() adds ordered callbacks scheduled on nextTick without awaiting results; exported declaration files provide the corresponding typed public API surface. — [entrypoints/main.js#L1-L2](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/main.js#L1-L2) [lib/worker/completion-handlers.js#L5-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/completion-handlers.js#L5-L12) [entrypoints/main.d.ts#L1-L20](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/main.d.ts#L1-L20)

## Contributor handoff

Start with the manifest, local test/configuration files, and the source modules governing the behavior being changed. Preserve worker protocol, test ordering, snapshot compatibility, and public declaration semantics across edits. Tests and CI were inspected, not executed, so this brief provides no passing baseline. Under this task's read-only authority, commands below are future validation guidance rather than authorization to run them.
- Read package.json, ava.config.js, .taprc, and scripts/test.sh first to distinguish published runtime entrypoints from the @ava/test and TAP development harnesses. — [package.json#L11-L39](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/package.json#L11-L39) [ava.config.js#L5-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/ava.config.js#L5-L12) [.taprc#L1-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.taprc#L1-L8) [scripts/test.sh#L4-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/test.sh#L4-L8)
- For CLI/configuration changes, follow loadCli(), loadConfig(), and existing loader tests; explicit configuration has different conflict semantics from automatically discovered configuration. — [lib/cli.js#L95-L111](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/cli.js#L95-L111) [lib/load-config.js#L84-L86](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L84-L86) [lib/load-config.js#L127-L147](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/load-config.js#L127-L147) [test/config/loader.js#L61-L74](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/config/loader.js#L61-L74)
- For worker lifecycle changes, read fork.js, worker/base.js, and worker/channel.js together; preserve ready-for-options, worker-finished/free-worker, peer-failed, and channel reference semantics. — [lib/fork.js#L106-L114](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/fork.js#L106-L114) [lib/worker/base.js#L90-L92](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L90-L92) [lib/worker/base.js#L122-L129](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/base.js#L122-L129) [lib/worker/channel.js#L100-L111](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/worker/channel.js#L100-L111)
- Keep file concurrency distinct from within-file concurrency, and preserve success-only after hooks versus always hooks; fail-fast does not cancel concurrent tests already started within a file. — [lib/api.js#L248-L258](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/api.js#L248-L258) [lib/runner.js#L374-L403](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L374-L403) [lib/runner.js#L501-L530](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/runner.js#L501-L530)
- Snapshot edits must preserve title/index identity, skipped-block retention, deterministic encoding, and format versioning; the source explicitly requires a major AVA version bump for incompatible encoding changes. — [lib/snapshot-manager.js#L20-L23](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L20-L23) [lib/snapshot-manager.js#L209-L224](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L209-L224) [lib/snapshot-manager.js#L360-L382](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/snapshot-manager.js#L360-L382) [test/snapshot-workflow/selection.js#L7-L65](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test/snapshot-workflow/selection.js#L7-L65)
- Update runtime declaration chains and public types together; TypeScript cases are checked by tsc, and examples pin AVA ^6 despite the root package being 8.0.1. — [entrypoints/main.d.ts#L1-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/entrypoints/main.d.ts#L1-L12) [test-types/module/conditional-chains.ts#L1-L14](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/test-types/module/conditional-chains.ts#L1-L14) [scripts/test.sh#L5-L5](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/test.sh#L5-L5) [examples/macros/package.json#L8-L10](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/examples/macros/package.json#L8-L10)
- When execution is separately authorized, use the documented smallest test selection first: npx test-ava test/{file}.js or npx tap test-tap/{file}.js; npm test adds lint, types, and coverage. — [.github/CONTRIBUTING.md#L60-L70](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/CONTRIBUTING.md#L60-L70) [scripts/test.sh#L4-L8](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/test.sh#L4-L8)
- Tests and CI were inspected, not executed; future validation must account for serial watch testing, non-Linux reporter exclusions, and compile-only type cases rather than assuming uniform suite execution. — [scripts/ci.sh#L4-L17](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/scripts/ci.sh#L4-L17) [.github/workflows/ci.yml#L44-L61](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/.github/workflows/ci.yml#L44-L61) [tsconfig.json#L9-L12](https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/tsconfig.json#L9-L12)

Source repository: https://github.com/avajs/ava
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/ava.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
