CodeVetter · Repo Unpack · Extension points
jestjs/jest
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.
- Configured transformer modules may export a transformer or createTransformer factory; loadTransformers validates process/processAsync and stores implementations by pattern and module path.
- 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.
- Configured runners are instantiated with globalConfig, change context, and runnerOptions; per-file environment, framework, and optional runtime modules are independently loaded by runTestInternal.
- 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.
- 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.
- 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.
- 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.