Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest process "watch-tests" ended unexpectedly: npm not found #867

Closed
Morriz opened this issue May 18, 2022 · 6 comments · Fixed by #874 or #941
Closed

Jest process "watch-tests" ended unexpectedly: npm not found #867

Morriz opened this issue May 18, 2022 · 6 comments · Fixed by #874 or #941

Comments

@Morriz
Copy link

Morriz commented May 18, 2022

Environment

  1. vscode-jest version: v4.4.0
  2. node -v: v16.14.2
  3. npm -v or yarn --version: 8.5.0
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): react-scripts@5.0.1
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? [fill]
    • jest.autoRun? [fill]
    • anything else that you think might be relevant? [fill]
  6. Operating system: OSX 12.3.1

Prerequisite

  • are you able to run jest test from the command line? yes
  • how do you run your tests from the command line? npm test which runs react-scripts test

Steps to Reproduce

Open a react-scripts project that has the extension installed. Only upon startup is an error shown, and the waiting script re-runs successfully after touching any file. Race condition?

Also, setting a custom command is giving the same errors.

The jest config:

module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  modulePathIgnorePatterns: ['.history'],
  transform: {
    '^.+\\.test.(ts|tsx)?$': 'ts-jest',
  },
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}

Relevant Debug Info

Without configuring anything (out of the box) I see this error:

not-test onProcessExit: process exit with code=127, signal=undefined
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting
/bin/sh: npm: command not found
Jest process "watch-tests" ended unexpectedly
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

Expected Behavior

No error messages

Actual Behavior

Error messages


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

@Morriz
Copy link
Author

Morriz commented May 18, 2022

I tried uninstalling, cleaning prefs, reinstalling, but no dice.

@Morriz
Copy link
Author

Morriz commented May 18, 2022

We use the same config in another repo where these errors don't appear. I am trying to find out what is diff

@connectdotz
Copy link
Collaborator

/bin/sh: npm: command not found

this usually indicates a shell env issue. Try to start vscode from a terminal (instead of UI).

more detailed info here

@Morriz
Copy link
Author

Morriz commented May 23, 2022

I always start it from shell, and all my windows work fine. If the app can't find npm in PATH then I presume PATH must be different suddenly. Hmmm

@connectdotz
Copy link
Collaborator

you can verify the path via the developer console:

See additional logging from the developer console (via Help > Toggle Developer Tools menu), look for the spawn log, expand the "options" object, then "env", the "PATH" (inherited from vscode process) should be there:

ezgif com-gif-maker

@Morriz
Copy link
Author

Morriz commented May 24, 2022

ok, got vscode updates and the issue is gone...may have been some local state that got corrupt. Tnx for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants