Matched signals
- jest: command not found
- path.*\.bin/jest
jest command not found or not installed
What this failure means
The jest command could not be found. Jest is either not installed as a dependency, not in the PATH, or the wrong shell was used to run it.
Symptoms
Faultline looks for one or more of these log fragments:
jest: command not found
path.*\.bin/jest
Diagnosis
Jest is typically installed locally as a dev dependency and accessed through npm run test or npx jest. Common causes:
- Jest is not listed in
package.jsonas adevDependency. npm installornpm ciwas not run before the test step, or it failed silently.- The script is running in a different shell that does not have the PATH updated.
- Jest is installed locally but the script tries to use the global
jestcommand. - The test step runs before the install step in CI.
The error typically appears as jest: command not found or jest is not installed.
Fix steps
-
Verify Jest is in
package.json:grep jest package.json -
If missing, add it as a dev dependency:
npm install --save-dev jest -
Ensure
npm installcompletes before running tests:npm install npm test -
Use
npm run testornpx jestinstead of callingjestdirectly:npm run test # Uses local jest from node_modules npx jest # Also uses local jest jest # May not work if jest is not in PATH -
Check that the CI job runs the test step after the install step:
steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: '18' - run: npm install # Must run BEFORE test - run: npm test # Now jest is available
Validation
npm installcompletes without errors.npm run testornpx jestexecutes tests successfully.npm ls jestshows jest is installed innode_modules.
Why it matters
Missing test runners block the entire test pipeline. Test failures cannot be diagnosed if the test command itself fails to run.
Prevention
- Always run
npm install(ornpm ci) before test steps in CI. - Use
npm run testinstead of calling commands directly. - Document the test command in
package.jsonandREADME.md. - Commit
package-lock.jsonto ensure consistent installs.
Try it locally
npm install
npm run test
npm ls jest
npm ls jest
npm test
How Faultline detects it
Use faultline explain jest-command-not-found to see the full playbook.
faultline analyze build.log
faultline explain jest-command-not-found
Generated from playbooks/bundled/log/test/jest-command-not-found.yaml. Do not edit directly.