# jestjs/jest — codebase unpack

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

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

- Scanned commit: 61050e9323e742539dc2360236671110e37329e6 (2026-10-02)
- Last upstream commit: chore(deps): update dependency eslint-plugin-jsdoc to v65 (#16480)
- Generated by codevetter 1.15.0 on 2026-10-02
- 3401 files scanned · 9.6 MB

Source inspection; upstream code and tests were not executed.

## Languages

- JavaScript: 1298 files
- TypeScript: 963 files
- JSON: 550 files
- Markdown: 275 files
- YAML: 23 files
- CSS: 11 files
- Sass: 1 files
- Shell: 1 files

## Repository structure

- e2e/ — 1567 files
- packages/ — 1388 files
- website/ — 222 files
- examples/ — 105 files
- docs/ — 38 files
- .github/ — 22 files
- scripts/ — 15 files
- benchmarks/ — 5 files

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

## Package

- package.json: @jest/monorepo v0.0.0 — 78 declared dependencies

## Structural health signals

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

## Recent history

- 61050e9323e7 (2026-10-02) chore(deps): update dependency eslint-plugin-jsdoc to v65 (#16480)
- 202dd8a14777 (2026-09-18) v30.5.2
- 15c3d19dc280 (2026-09-18) chore: prepare for v30.5.2
- f2e2aa285f00 (2026-09-18) chore(deps): lock file maintenance (#16410)
- 4685157f782c (2026-09-18) chore: update ts-eslint (#16440)

## Overview

Jest is a JavaScript testing platform for application and library developers, combining test discovery, parallel execution, assertions, mocking, coverage, snapshots, and interactive watch mode. At commit 61050e9323e742539dc2360236671110e37329e6, its TypeScript packages separate orchestration from per-file environments, module loading, and test-framework execution; the runtime includes both asynchronous ESM loading and capability-gated synchronous require(esm). This brief follows CLI execution, module loading, and snapshot persistence through source and tests, with a bounded inspection of the separate Docusaurus website and repository automation.

## System map

The executable product is a collection of Node packages with a CLI and programmatic orchestration API. Configuration and file indexing establish project contexts before runners execute individual test files in configured environments. Persistence consists of filesystem caches, snapshots, and report artifacts. The documentation website has its own build and deployment boundary.
- The private root workspace includes packages, website, and examples, pins yarn@4.18.0, and declares Node support as ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0. — [package.json#L136-L140](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L136-L140) [package.json#L206-L223](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L206-L223)
- The jest-cli package exposes the jest executable and CJS/ESM package exports; bin/jest.js delegates to import-local before invoking run(). — [packages/jest-cli/package.json#L5-L16](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/package.json#L5-L16) [packages/jest-cli/package.json#L40-L44](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/package.json#L40-L44) [packages/jest-cli/bin/jest.js#L9-L17](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/bin/jest.js#L9-L17)
- runCLI is the orchestration boundary: it loads configurations, selects projects, builds Haste contexts, and branches into watch or one-shot execution. — [packages/jest-core/src/cli/index.ts#L38-L56](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L38-L56) [packages/jest-core/src/cli/index.ts#L143-L170](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L143-L170) [packages/jest-core/src/cli/index.ts#L220-L247](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L220-L247)
- TestScheduler loads configured runners, partitions tests by runner path and runnerOptions, and determines serial execution using shouldRunInBand or runner.isSerial. — [packages/jest-core/src/TestScheduler.ts#L241-L282](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L241-L282) [packages/jest-core/src/TestScheduler.ts#L356-L376](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L356-L376)
- jest-runner executes files directly in serial mode or through a jest-worker pool with optional worker threads, serialized resolver maps, piped output, and explicit worker cleanup. — [packages/jest-runner/src/index.ts#L53-L84](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L53-L84) [packages/jest-runner/src/index.ts#L97-L125](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L97-L125) [packages/jest-runner/src/index.ts#L184-L198](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L184-L198)
- Runtime composes ModuleRegistries, Resolution, MockState, TransformCache, JestGlobals, EsmLoader, ModuleExecutor, and CjsLoader for each test-file execution. — [packages/jest-runtime/src/index.ts#L126-L167](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L126-L167) [packages/jest-runtime/src/index.ts#L181-L233](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L181-L233) [packages/jest-runtime/src/index.ts#L235-L280](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L235-L280)
- The build script bundles packages with Webpack and generates .mjs wrappers from CJS exports; yarn build additionally builds and bundles declarations, while Lerna tracks package version 30.5.2. — [scripts/build.mjs#L26-L38](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/scripts/build.mjs#L26-L38) [scripts/build.mjs#L56-L90](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/scripts/build.mjs#L56-L90) [package.json#L96-L101](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L96-L101) [lerna.json#L1-L11](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/lerna.json#L1-L11)
- The website uses Docusaurus and React, reads documentation from ../docs, fetches Open Collective supporter data, and publishes website/build through Netlify production or preview commands. — [website/package.json#L5-L18](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/website/package.json#L5-L18) [website/package.json#L32-L45](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/website/package.json#L32-L45) [website/docusaurus.config.mjs#L49-L70](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/website/docusaurus.config.mjs#L49-L70) [netlify.toml#L4-L24](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/netlify.toml#L4-L24)

## Feature catalog

The inspected user surface spans test selection, execution, assertions, mocks, snapshots, coverage, and diagnostic output. Selection can operate on paths, dependency relationships, project names, cached failures, or sequencer shards. Watch mode and declaration collection provide different workflows over the same orchestration machinery. The catalog groups related APIs and options rather than claiming an exhaustive listing of every matcher or flag.
- Test selection supports roots, testMatch, testRegex, ignore patterns, direct paths, related source files, and onlyChanged dependency selection; CLI project selection also supports selectProjects and ignoreProjects. — [packages/jest-core/src/SearchSource.ts#L66-L101](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/SearchSource.ts#L66-L101) [packages/jest-core/src/SearchSource.ts#L270-L304](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/SearchSource.ts#L270-L304) [packages/jest-core/src/cli/index.ts#L80-L98](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L80-L98)
- runJest supports sequencer-based sharding, sorting, and onlyFailures selection; --listTests emits unique selected file paths as text or JSON, optionally to outputFile. — [packages/jest-core/src/runJest.ts#L291-L329](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L291-L329)
- --collectTests schedules files with silent output, disabled coverage, and an empty reporter list, then returns declaration trees or JSON; Circus loads setup and test modules before skipping test-body execution. — [packages/jest-core/src/runJest.ts#L334-L366](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L334-L366) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L80-L107](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L80-L107)
- Watch mode loads built-in and third-party plugins, reacts to Haste file changes, reruns tests, emits completion hooks, and retains failed test results for subsequent selection. — [packages/jest-core/src/watch.ts#L158-L217](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/watch.ts#L158-L217) [packages/jest-core/src/watch.ts#L249-L260](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/watch.ts#L249-L260) [packages/jest-core/src/watch.ts#L284-L335](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/watch.ts#L284-L335)
- expect(actual) constructs ordinary, negated, resolves, and rejects matcher surfaces; expect.extend and addEqualityTesters register custom behavior alongside built-in assertion, spy, and throw matchers. — [packages/expect/src/index.ts#L105-L150](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/expect/src/index.ts#L105-L150) [packages/expect/src/index.ts#L397-L401](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/expect/src/index.ts#L397-L401) [packages/expect/src/index.ts#L458-L464](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/expect/src/index.ts#L458-L464)
- Mock APIs include fn, method/accessor spyOn, replaceProperty, module mock dispatch, and module isolation; clearAllMocks, resetAllMocks, and restoreAllMocks have distinct state-reset operations. — [packages/jest-mock/src/index.ts#L1233-L1242](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-mock/src/index.ts#L1233-L1242) [packages/jest-mock/src/index.ts#L1270-L1288](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-mock/src/index.ts#L1270-L1288) [packages/jest-mock/src/index.ts#L1591-L1598](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-mock/src/index.ts#L1591-L1598) [packages/jest-runtime/src/index.ts#L592-L603](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L592-L603)
- Snapshot APIs support external and inline matching, custom serializers, and custom path resolvers; update modes control additions, replacements, obsolete-key removal, and empty-file deletion. — [packages/jest-snapshot/src/index.ts#L157-L161](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L157-L161) [packages/jest-snapshot/src/index.ts#L214-L217](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L214-L217) [packages/jest-snapshot/src/State.ts#L304-L349](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L304-L349) [packages/jest-snapshot/src/SnapshotResolver.ts#L50-L56](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/SnapshotResolver.ts#L50-L56)
- Execution supports per-file environment docblocks, setup hooks, globally enabled fake timers, and V8 coverage; output options include default/verbose, agent, GitHub Actions, summary, custom, coverage, notification, and JSON reporting. — [packages/jest-runner/src/runTest.ts#L90-L123](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L90-L123) [packages/jest-runner/src/runTest.ts#L271-L295](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L271-L295) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L45-L77](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L45-L77) [packages/jest-core/src/TestScheduler.ts#L382-L429](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L382-L429)

## Data flow

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. — [packages/jest-cli/src/run.ts#L20-L29](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/src/run.ts#L20-L29) [packages/jest-cli/src/run.ts#L44-L78](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/src/run.ts#L44-L78)
- readConfig calls readInitialOptions, normalize, and groupOptions; inline JSON --config receives a default rootDir, while configuration files resolve relative rootDir against their containing directory. — [packages/jest-config/src/index.ts#L95-L119](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/index.ts#L95-L119) [packages/jest-config/src/index.ts#L352-L374](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/index.ts#L352-L374) [packages/jest-config/src/readConfigFileAndSetRootDir.ts#L107-L131](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L107-L131)
- 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. — [packages/jest-haste-map/src/index.ts#L366-L395](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-haste-map/src/index.ts#L366-L395) [packages/jest-core/src/cli/index.ts#L151-L166](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L151-L166)
- 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. — [packages/jest-core/src/SearchSource.ts#L177-L200](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/SearchSource.ts#L177-L200) [packages/jest-core/src/SearchSource.ts#L325-L355](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/SearchSource.ts#L325-L355)
- 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. — [packages/jest-runner/src/index.ts#L97-L122](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L97-L122) [packages/jest-runner/src/index.ts#L140-L154](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L140-L154) [packages/jest-runner/src/index.ts#L174-L180](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L174-L180)
- 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. — [packages/jest-runner/src/runTest.ts#L113-L127](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L113-L127) [packages/jest-runner/src/runTest.ts#L192-L209](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L192-L209) [packages/jest-runtime/src/internals/ModuleExecutor.ts#L136-L144](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/ModuleExecutor.ts#L136-L144) [packages/jest-transform/src/ScriptTransformer.ts#L508-L558](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-transform/src/ScriptTransformer.ts#L508-L558)
- 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. — [packages/jest-snapshot/src/index.ts#L290-L319](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L290-L319) [packages/jest-snapshot/src/index.ts#L376-L384](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L376-L384) [packages/jest-snapshot/src/State.ts#L304-L333](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L304-L333) [packages/jest-snapshot/src/State.ts#L375-L435](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L375-L435)
- 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. — [packages/jest-core/src/TestScheduler.ts#L337-L351](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L337-L351) [packages/jest-test-sequencer/src/index.ts#L223-L243](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-test-sequencer/src/index.ts#L223-L243) [packages/jest-core/src/runJest.ts#L173-L212](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L173-L212) [packages/jest-core/src/runJest.ts#L431-L451](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L431-L451)

## Behavior traces

Three concrete flows were followed through implementation: CLI startup and execution, module loading, and snapshot persistence. The execution trace includes the distinction between suite runners and the in-environment framework. Module loading branches on mocks, registry state, file type, and VM capabilities. Snapshot persistence includes retry rollback and cleanup of unchecked keys.
- Startup: bin/jest.js first attempts importLocal; otherwise it defaults NODE_ENV to test, calls run(), then buildArgv → getProjectListFromCLIArgs → runCLI → readConfigs. — [packages/jest-cli/bin/jest.js#L9-L17](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/bin/jest.js#L9-L17) [packages/jest-cli/src/run.ts#L20-L29](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/src/run.ts#L20-L29) [packages/jest-core/src/cli/index.ts#L53-L56](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L53-L56)
- One-shot orchestration: runCLI → _run10000 → buildContextsAndHasteMaps; each project creates a cache directory, calls Runtime.createHasteMap().build(), and constructs a context before runWithoutWatch. — [packages/jest-core/src/cli/index.ts#L143-L170](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L143-L170) [packages/jest-core/src/cli/index.ts#L173-L182](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L173-L182) [packages/jest-core/src/cli/index.ts#L220-L247](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L220-L247)
- Primary execution: runJest selects tests, shards before sorting, applies onlyFailures, runs globalSetup, schedules tests, caches results, runs globalTeardown, then processes results; listTests and collectTests return through earlier branches. — [packages/jest-core/src/runJest.ts#L269-L329](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L269-L329) [packages/jest-core/src/runJest.ts#L334-L366](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L334-L366) [packages/jest-core/src/runJest.ts#L397-L451](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L397-L451)
- Per-file execution: runTest → runTestInternal reads source/docblocks, loads environment and framework, constructs Runtime, executes setupFiles, calls environment.setup(), then invokes testFramework; runtime and environment teardown occur on the guarded completion path. — [packages/jest-runner/src/runTest.ts#L90-L127](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L90-L127) [packages/jest-runner/src/runTest.ts#L192-L238](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L192-L238) [packages/jest-runner/src/runTest.ts#L280-L296](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L280-L296) [packages/jest-runner/src/runTest.ts#L360-L385](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L360-L385)
- Circus execution: jestAdapter loads jestAdapterInit through requireInternalModule, calls initialize, registers reset/mock cleanup in beforeEach, loads setupFilesAfterEnv and the test module, then calls runAndTransformResultsToJestFormat → run. — [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L25-L43](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L25-L43) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L54-L120](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L54-L120) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L256-L267](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L256-L267)
- CJS loading: Runtime.requireModuleOrMock checks teardown and mock decisions, then dispatches to a mock, framework singleton, or requireModule; CjsLoader resolves paths, returns registry hits, pre-registers fresh modules for cycles, and removes failed loads. — [packages/jest-runtime/src/index.ts#L576-L603](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L576-L603) [packages/jest-runtime/src/internals/CjsLoader.ts#L77-L112](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/CjsLoader.ts#L77-L112) [packages/jest-runtime/src/internals/CjsLoader.ts#L129-L169](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/CjsLoader.ts#L129-L169)
- ESM loading: EsmLoader.loadAndEvaluate resolves an ESM path, calls loadEsmModule, then linkAndEvaluateModule; synchronous loading requires VM and resolver capabilities, while the asynchronous path links imports, validates attributes, and shares evaluation promises. — [packages/jest-runtime/src/internals/EsmLoader.ts#L1825-L1871](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/EsmLoader.ts#L1825-L1871) [packages/jest-runtime/src/internals/EsmLoader.ts#L2114-L2151](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/EsmLoader.ts#L2114-L2151) [packages/jest-runtime/src/internals/EsmLoader.ts#L2170-L2203](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/EsmLoader.ts#L2170-L2203)
- Snapshot persistence: initialize resolves the snapshot path and constructs SnapshotState; _toMatchSnapshot calls match, retry events call clear(test), and jestAdapter's _addSnapshotData protects failed/skipped tests, removes eligible unchecked keys, calls save, and transfers counters into TestResult. — [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L138-L155](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L138-L155) [packages/jest-snapshot/src/index.ts#L376-L384](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L376-L384) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L343-L349](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts#L343-L349) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L130-L162](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L130-L162)

## Testing signals

Tests and CI definitions were inspected, not executed; no passing result or measured coverage is asserted. The repository tests itself with Jest, using package-level tests, subprocess-based e2e drivers, and separate type checks. Inspected tests exercise collection semantics, CJS dispatch, and snapshot retry persistence, with explicit runner-specific conditions. This is a bounded inventory of evidence, not exhaustive coverage.
- The main suite transforms JS/TS with babel-jest, includes root and example projects, and excludes fixture directories from direct discovery; root scripts expose focused Jest, coverage, Jasmine, VM-module, and type-test commands. — [jest.config.mjs#L37-L41](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.mjs#L37-L41) [jest.config.mjs#L45-L81](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.mjs#L45-L81) [package.json#L108-L126](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L108-L126)
- Package unit tests live under __tests__, while e2e/__tests__ drivers execute fixture projects; e2e/runJest.ts launches the repository CLI with process.execPath and asserts captured subprocess results. — [CONTRIBUTING.md#L85-L95](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/CONTRIBUTING.md#L85-L95) [e2e/runJest.ts#L32-L62](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/runJest.ts#L32-L62) [e2e/runJest.ts#L121-L134](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/runJest.ts#L121-L134)
- CjsLoader unit tests stub resolution, registries, and execution, checking core-module routing, cached exports without re-execution, manual mock selection, and recursion avoidance; these tests alone do not establish real VM integration. — [packages/jest-runtime/src/internals/__tests__/CjsLoader.test.ts#L39-L89](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/__tests__/CjsLoader.test.ts#L39-L89) [packages/jest-runtime/src/internals/__tests__/CjsLoader.test.ts#L93-L176](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/__tests__/CjsLoader.test.ts#L93-L176)
- Collection e2e tests assert tree/JSON output, wouldRun flags, load-error reporting, no test-body execution, and parity with focused execution; test.failing parity cases explicitly skip Jasmine. — [e2e/__tests__/collectTests.test.ts#L24-L99](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/__tests__/collectTests.test.ts#L24-L99) [e2e/__tests__/collectTests.test.ts#L111-L162](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/__tests__/collectTests.test.ts#L111-L162)
- SnapshotState tests use temporary files to check retry rollback, preservation of other tests' inline/file writes, and no write after complete rollback; another test records the hint-separator ownership ambiguity. — [packages/jest-snapshot/src/__tests__/State.test.ts#L19-L49](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/__tests__/State.test.ts#L19-L49) [packages/jest-snapshot/src/__tests__/State.test.ts#L121-L187](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/__tests__/State.test.ts#L121-L187) [packages/jest-snapshot/src/__tests__/State.test.ts#L268-L276](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/__tests__/State.test.ts#L268-L276)
- Retry e2e tests inspect beforeAll describe recovery, snapshot restoration, and concurrent describe retries, but the entire inspected retry suite calls skipSuiteOnJasmine. — [e2e/__tests__/testRetries.test.ts#L8-L71](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/__tests__/testRetries.test.ts#L8-L71) [e2e/__tests__/testRetries.test.ts#L529-L557](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/__tests__/testRetries.test.ts#L529-L557)
- Node CI invokes sharded Ubuntu, macOS, and Windows jobs across Node 18/20/22/24/25/26; test jobs build JavaScript and use retries with three attempts and ten-minute timeouts, while separate jobs cover declarations, lint, VM modules, Watchman, and coverage. — [.github/workflows/nodejs.yml#L31-L93](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/nodejs.yml#L31-L93) [.github/workflows/nodejs.yml#L95-L127](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/nodejs.yml#L95-L127) [.github/workflows/nodejs.yml#L150-L181](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/nodejs.yml#L150-L181) [.github/workflows/test.yml#L14-L46](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/test.yml#L14-L46)
- Coverage collection excludes bin, cli, e2e, tests, builds, and vendor paths; TypeScript integration uses a separate configuration, and CI reporting emits JSON coverage plus GitHub Actions, JUnit, silent, and summary reports. These inspected definitions do not prove execution or comprehensive behavioral coverage. — [jest.config.mjs#L13-L25](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.mjs#L13-L25) [jest.config.ts.mjs#L11-L23](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.ts.mjs#L11-L23) [jest.config.ci.mjs#L11-L25](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.ci.mjs#L11-L25)

## Risk map

The following risks are source observations and maintenance limits, not confirmed vulnerabilities. Jest deliberately executes project code and extensibility modules, so configuration and snapshot inputs carry executable authority. Filesystem outputs and worker execution cross the repository-root boundary. Source comments and tests expose specific cache, validation, and ownership limitations without establishing their frequency in practice.
- getSnapshotData executes snapshot contents with new Function('exports', snapshotContents) before header validation and swallows evaluation errors; snapshot files must therefore be treated as executable trusted project inputs. — [packages/jest-snapshot-utils/src/utils.ts#L133-L164](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot-utils/src/utils.ts#L133-L164)
- Configuration files can execute modules or async exported functions, and orchestration loads custom filter/reporting modules; these paths run before or outside individual test bodies. — [packages/jest-config/src/readConfigFileAndSetRootDir.ts#L89-L114](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L89-L114) [packages/jest-core/src/cli/index.ts#L190-L217](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L190-L217) [packages/jest-core/src/TestScheduler.ts#L433-L443](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L433-L443)
- --clearCache recursively removes configured cache directories, outputFile resolves against cwd and is written directly, and inline snapshots rewrite paths derived from captured stack frames; these operations are not confined by a repository-root check in the inspected functions. — [packages/jest-core/src/cli/index.ts#L67-L77](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L67-L77) [packages/jest-core/src/runJest.ts#L197-L205](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L197-L205) [packages/jest-snapshot/src/State.ts#L167-L184](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L167-L184) [packages/jest-snapshot/src/InlineSnapshots.ts#L88-L118](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/InlineSnapshots.ts#L88-L118)
- The VM environment is not a complete security boundary: CjsLoader routes core modules through CoreModuleProvider and loads .node files with native require, while runTest wraps process.exit for diagnostics and still calls the real exit. — [packages/jest-runtime/src/internals/CjsLoader.ts#L83-L85](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/CjsLoader.ts#L83-L85) [packages/jest-runtime/src/internals/CjsLoader.ts#L293-L300](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/CjsLoader.ts#L293-L300) [packages/jest-runner/src/runTest.ts#L244-L268](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L244-L268)
- Changed-file detection launches Git subprocesses with project cwd and argument arrays; parallel runners cross process/thread boundaries with serialized configuration and module maps and can force workers to exit during cleanup. — [packages/jest-changed-files/src/git.ts#L13-L22](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-changed-files/src/git.ts#L13-L22) [packages/jest-changed-files/src/git.ts#L47-L75](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-changed-files/src/git.ts#L47-L75) [packages/jest-runner/src/index.ts#L97-L122](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L97-L122) [packages/jest-runner/src/index.ts#L184-L198](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/index.ts#L184-L198)
- ScriptTransformer explicitly documents that independently cached code and source maps can become mismatched under concurrent writes; code checksums and atomic writes protect code artifacts but do not establish code/map pairing. — [packages/jest-transform/src/ScriptTransformer.ts#L514-L527](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-transform/src/ScriptTransformer.ts#L514-L527) [packages/jest-transform/src/ScriptTransformer.ts#L949-L981](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-transform/src/ScriptTransformer.ts#L949-L981)
- Snapshot ownership has known compatibility limits: clear() without identity does not roll back file data or unchecked keys, and keys using ': ' cannot distinguish a hint from a longer test name, potentially retaining obsolete snapshots. — [packages/jest-snapshot/src/State.ts#L235-L248](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L235-L248) [packages/jest-snapshot/src/State.ts#L135-L143](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L135-L143) [packages/jest-snapshot/src/__tests__/State.test.ts#L268-L276](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/__tests__/State.test.ts#L268-L276)
- Configuration normalization validates before preset merging, with a TODO stating preset-contributed options escape that validation; multiple projects without explicit --config also inherit global settings from the first project's configuration as a documented compatibility fallback. — [packages/jest-config/src/normalize.ts#L546-L575](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/normalize.ts#L546-L575) [packages/jest-config/src/index.ts#L488-L495](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/index.ts#L488-L495)

## Extension points

Jest exposes extension seams at configuration, discovery, execution, module resolution, transformation, assertion, snapshot, and reporting boundaries. Most external implementations are loaded by configured module paths rather than a centralized plugin registry. Several seams carry distinct synchronous and asynchronous contracts. Runtime composition also preserves public dispatch callbacks for alternate runtime implementations.
- CLI options are declared in args.options and checked by args.check before validateCLIOptions; configuration normalization merges argv and presets, making flag additions a coordinated CLI/configuration change. — [packages/jest-cli/src/run.ts#L51-L67](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/src/run.ts#L51-L67) [packages/jest-cli/src/args.ts#L22-L92](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/src/args.ts#L22-L92) [packages/jest-config/src/normalize.ts#L567-L575](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/normalize.ts#L567-L575)
- Configured transformer modules may export a transformer or createTransformer factory; loadTransformers validates process/processAsync and stores implementations by pattern and module path. — [packages/jest-transform/src/ScriptTransformer.ts#L297-L328](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-transform/src/ScriptTransformer.ts#L297-L328)
- Custom resolver modules can be functions or objects with sync and async hooks, receiving basedir, conditions, extensions, paths, rootDir, and default resolver helpers; synchronous require(esm) rejects an async-only resolver. — [packages/jest-resolve/src/resolver.ts#L131-L165](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-resolve/src/resolver.ts#L131-L165) [packages/jest-resolve/src/resolver.ts#L174-L195](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-resolve/src/resolver.ts#L174-L195) [packages/jest-runtime/src/internals/EsmLoader.ts#L353-L373](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/EsmLoader.ts#L353-L373)
- Configured runners are instantiated with globalConfig, change context, and runnerOptions; per-file environment, framework, and optional runtime modules are independently loaded by runTestInternal. — [packages/jest-core/src/TestScheduler.ts#L246-L263](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L246-L263) [packages/jest-runner/src/runTest.ts#L105-L128](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L105-L128)
- Custom testSequencer implementations supply sort and cacheResults, with shard required when sharding is requested; discovery filters expose optional async setup and return a filtered path array. — [packages/jest-core/src/runJest.ts#L247-L250](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L247-L250) [packages/jest-core/src/runJest.ts#L291-L306](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L291-L306) [packages/jest-core/src/runJest.ts#L434-L436](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L434-L436) [packages/jest-core/src/cli/index.ts#L190-L217](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/cli/index.ts#L190-L217)
- Watch plugins receive config/stdin/stdout, can apply hook subscriptions, and are checked for key conflicts; custom reporters receive globalConfig/options/context, while testResultsProcessor can asynchronously replace aggregate results. — [packages/jest-core/src/watch.ts#L188-L217](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/watch.ts#L188-L217) [packages/jest-core/src/TestScheduler.ts#L433-L443](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/TestScheduler.ts#L433-L443) [packages/jest-core/src/runJest.ts#L192-L195](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-core/src/runJest.ts#L192-L195)
- Assertion extensions use expect.extend and addEqualityTesters; snapshot serializers prepend to the plugin list, and custom snapshot resolvers must implement both path transforms plus a round-trip consistency example. — [packages/expect/src/index.ts#L397-L401](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/expect/src/index.ts#L397-L401) [packages/jest-snapshot/src/plugins.ts#L24-L39](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/plugins.ts#L24-L39) [packages/jest-snapshot/src/SnapshotResolver.ts#L82-L109](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/SnapshotResolver.ts#L82-L109) [packages/jest-snapshot/src/SnapshotResolver.ts#L120-L130](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/SnapshotResolver.ts#L120-L130)
- Runtime supplies public-method callbacks to RequireBuilder, EsmLoader, and JestGlobals rather than directly binding all internal loaders; repository guidance explicitly identifies requireModule and related methods as subclass override seams. — [packages/jest-runtime/src/index.ts#L181-L215](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L181-L215) [packages/jest-runtime/src/index.ts#L218-L233](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/index.ts#L218-L233) [.github/copilot-instructions.md#L191-L195](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/copilot-instructions.md#L191-L195)

## Contributor handoff

Tests and CI were inspected, not executed, and this brief does not certify a passing checkout. Start from the relevant package source and preserve contracts at configuration, Runtime, runner, and persistence boundaries. Small focused changes must account for cross-package imports loading built artifacts and for separately checked declarations. Future execution requires authorization appropriate to that task; this investigation performed only source reads and searches.
- Read root/package manifests, jest.config.mjs, and the implementing package first; build exports point to build artifacts, while root scripts distinguish JavaScript bundling, declaration build, and declaration bundling. — [packages/jest-cli/package.json#L5-L16](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-cli/package.json#L5-L16) [package.json#L96-L101](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L96-L101) [jest.config.mjs#L79-L81](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/jest.config.mjs#L79-L81)
- For an authorized change, use the existing yarn jest <path> workflow first; rebuild JavaScript when e2e or other workspaces consume the edit, and use the full build when declarations or cross-package type checks change. — [.github/copilot-instructions.md#L7-L15](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/copilot-instructions.md#L7-L15) [.github/copilot-instructions.md#L19-L28](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/copilot-instructions.md#L19-L28) [package.json#L128-L130](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L128-L130)
- Runtime edits must retain public dispatch seams and capability conditions; nodeCapabilities detects SyntheticModule and SourceTextModule.prototype.hasAsyncGraph, while ESM loading also checks resolver capabilities. — [packages/jest-runtime/src/internals/nodeCapabilities.ts#L8-L14](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/nodeCapabilities.ts#L8-L14) [packages/jest-runtime/src/internals/EsmLoader.ts#L1845-L1864](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runtime/src/internals/EsmLoader.ts#L1845-L1864) [.github/copilot-instructions.md#L193-L195](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/copilot-instructions.md#L193-L195)
- Preserve runTestInternal as a separate closure for leak detection and keep runtime teardown before environment teardown; its setupFiles execution occurs before the later guarded framework-execution block. — [packages/jest-runner/src/runTest.ts#L73-L82](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L73-L82) [packages/jest-runner/src/runTest.ts#L213-L239](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L213-L239) [packages/jest-runner/src/runTest.ts#L280-L296](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L280-L296) [packages/jest-runner/src/runTest.ts#L379-L393](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-runner/src/runTest.ts#L379-L393)
- Snapshot edits should read State, matcher dispatch, adapter persistence, and snapshot utilities together; preserve identity-based retry rollback and the CI normalization that selects none unless updateSnapshot is explicitly requested. — [packages/jest-snapshot/src/State.ts#L251-L289](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/State.ts#L251-L289) [packages/jest-snapshot/src/index.ts#L376-L384](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-snapshot/src/index.ts#L376-L384) [packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L130-L162](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts#L130-L162) [packages/jest-config/src/normalize.ts#L1175-L1184](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/packages/jest-config/src/normalize.ts#L1175-L1184)
- Add e2e behavior through fixture files rather than jest.fn/mock/spyOn in driver tests; the subprocess helper strips agent-detection variables and disables colors, so output assertions depend on that controlled environment. — [eslint.config.mjs#L464-L479](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/eslint.config.mjs#L464-L479) [e2e/runJest.ts#L99-L115](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/e2e/runJest.ts#L99-L115)
- Follow strict TypeScript and repository formatting constraints, use graceful-fs/globalThis in the governed source, and preserve bare built-in imports in browser-compatible packages where node: imports are explicitly prohibited. — [tsconfig.json#L12-L25](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/tsconfig.json#L12-L25) [package.json#L141-L146](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L141-L146) [eslint.config.mjs#L206-L213](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/eslint.config.mjs#L206-L213) [eslint.config.mjs#L635-L649](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/eslint.config.mjs#L635-L649)
- Tests and CI were inspected, not executed: future validation should select the relevant existing package/e2e/type scripts and report actual results. Keep release/deployment separate because pkg-pr-new publishes packages and website production preparation performs supporter fetches and Crowdin upload/download. — [package.json#L108-L130](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/package.json#L108-L130) [.github/workflows/test.yml#L31-L46](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/test.yml#L31-L46) [.github/workflows/pkg-pr-new.yml#L25-L32](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/.github/workflows/pkg-pr-new.yml#L25-L32) [website/package.json#L13-L17](https://github.com/jestjs/jest/blob/61050e9323e742539dc2360236671110e37329e6/website/package.json#L13-L17)

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

## Public product links

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