CodeVetter · Repo Unpack · Data flow
jestjs/jest
Arguments and configuration enter through separate parsing and normalization stages before becoming execution settings. Indexed files and dependency relationships become selected Test objects, which runners consume locally or across worker boundaries. Per-file Runtime objects own module and transform state, while snapshot state owns assertion persistence. Results flow back into aggregation, sequencing caches, reporters, and optional JSON files.
- buildArgv parses process arguments through the args option table and check function, validates CLI options, removes dashed duplicate keys, and passes normalized argv plus project paths to runCLI.
- readConfig calls readInitialOptions, normalize, and groupOptions; inline JSON --config receives a default rootDir, while configuration files resolve relative rootDir against their containing directory.
- HasteMap.build converts crawled file data into HasteFS and HasteModuleMap, persisting rebuilt maps when changes are unknown or files changed; CLI context construction consumes the completed map.
- SearchSource resolves inverse dependencies for related-test selection and intersects custom filter results with already discovered tests; invalid filter output without a filtered array raises TypeError.
- Parallel execution serializes each project's module map and converts changed-file Sets into arrays; worker calls receive project/global configuration and a test path, then emit file success or failure events.
- runTestInternal seeds cacheFS with test source and constructs Runtime; ModuleExecutor transforms and compiles loaded JS, while ScriptTransformer reads cached code or invokes a configured transformer and writes cache artifacts.
- Snapshot matcher context supplies test name and identity to SnapshotState.match; serialized received values update state under the selected update mode, and save writes external snapshot files or rewrites inline source files.
- Completed TestResults determine aggregate success, populate sequencer failure/timing caches, and optionally pass through testResultsProcessor before formatted JSON reaches stdout or a cwd-resolved outputFile.