Jest environment inspection
Version baseline: Jest 30.x, with 30.4.2 as the current stable release at this review. Inspect the installed patch, Node.js support, module system, test environment, and transformer compatibility before changing configuration.
Build a factual map of the project's Jest setup before changing or running anything. This skill is read-only unless the user explicitly asks to repair the environment.
Inspection workflow
Establish the project root. Look for
package.json, lockfiles, workspace declarations, and the nearest repository instructions. Do not assume the current directory is the package that owns the tests.Identify the package manager from the lockfile and package metadata:
package-lock.json→ npm,yarn.lock→ Yarn,pnpm-lock.yaml→ pnpm,bun.lockorbun.lockb→ Bun. In a workspace, identify the package that owns the test file and its root command.Read the relevant
package.jsonscripts and dev dependencies. Prefer the existingtest,test:watch,test:ci, or package-specific script over an invented direct command.Check the installed Jest version through the project runner:
npm exec -- jest --version # or: yarn jest --version # or: pnpm exec jest --version # or: bunx jest --versionIf the command cannot resolve Jest, report the package and version evidence; do not install it unless asked.
Locate configuration without guessing which file wins. Check
jest.config.*, ajestfield inpackage.json, workspace project configs, and script-level--configflags. Then usejest --showConfigthrough the project runner to inspect the resolved configuration.Record the effective
rootDir,testMatchortestRegex, ignored paths,testEnvironment,transform,moduleNameMapper, setup files, projects, coverage settings, and mock-reset settings.List likely test files and confirm discovery with:
<project-jest-command> --listTestsUse
--collectTestswhen the installed Jest version supports it and test names, not only file paths, need to be inspected.
Report format
Return a compact environment report containing:
- project/package root and package manager;
- Node and Jest versions;
- the script used to invoke tests;
- config source and effective values that affect the request;
- discovered test count or representative paths;
- the smallest next command for the user's task;
- any uncertainty, such as a workspace boundary or an unresolved transform.
Guardrails
- Never edit
package.json, lockfiles, Jest config, setup files, or test files as part of inspection. - Never treat a missing local Jest binary as permission to use a global binary; global Jest can use a different version and config.
- If a script chains other tools, show the complete script and explain where Jest arguments must be inserted.