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

Bug: Spawning Jest on Windows with jest-editor-support < 22.1.3 #274

Closed
seanpoulter opened this issue Feb 24, 2018 · 3 comments · Fixed by #324 or #340
Closed

Bug: Spawning Jest on Windows with jest-editor-support < 22.1.3 #274

seanpoulter opened this issue Feb 24, 2018 · 3 comments · Fixed by #324 or #340
Labels

Comments

@seanpoulter
Copy link
Member

seanpoulter commented Feb 24, 2018

Environment

  1. node -v: 8.9.1
  2. npm -v: 5.5.1
  3. npm ls react-scripts (if you haven’t ejected): N/A
  4. Operating system: Windows
  • Jest: 21.2.1

Problem

Our recent changes to the way we spawn Jest on Windows has introduced a regression in projects that aren't using jest-editor-support version ^22.1.3. This presents itself in two ways:

In release 2.6.4:

Jest appears to run propertly, but there is an error in the Developer Tools console:

  ERR spawn node_modules\.bin\jest ENOENT: Error: spawn node_modules\.bin\jest ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.__dirname.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9)

When debugging the extension, the first uncaught error shares the same call stack:
image

Debugging the extension from master:

  • Jest starts, but fails. The status bar shows: "Jest: Stopped"
  • The Jest output channel states:

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT
Finished running all tests. Starting watch mode.

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT

Exception raised: Process failed: spawn node_modules\.bin\jest ENOENT
Starting Jest in Watch mode failed too many times and has been stopped. Please check your system configuration.
  • The Developer Tools console includes the same error:
  ERR spawn node_modules\.bin\jest ENOENT: Error: spawn node_modules\.bin\jest ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.__dirname.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9)

Steps to Reproduce

  • Clone https://github.com/seanpoulter/vscode-jest-181
  • Install the default packages: yarn install
  • Remove Jest: yarn remove jest
  • Add Jest v21.2.1: yarn add jest@21.2.1
  • Open the folder with 2.6.4 or debugging the extension to reproduce both failure modes above

Expected Behavior

  • The usual behavior
  • No error on the console

CC @stephtr

@stephtr
Copy link
Member

stephtr commented Feb 24, 2018

Somehow I couldn't reproduce that bug using just those steps (I am running node 9.3.0, but that shouldn't make any differences). In my case there is an error showing up in developer console but the extension is nevertheless running fine. Isn't the extension using its own (specified) supplied jest-editor-support package instead of one within the opened project (in this case there isn't even such a package installed within the project)?

However on all versions of Jest used I noticed that it trys to spawn jest two times: Once without the shell property set at Settings.exports.createProcess and once with shell set to true at Runner.exports.createProcess.
Is it possible that this is an issue within jest-editor-support, more specifically Settings.js#63? In my opinion that process should be created within a shell, too.

@seanpoulter
Copy link
Member Author

Brilliant, thanks @stephtr! 👍 My Windows box hasn't seen much use lately and had Jest v21.

I'll submit a PR to spawn with the shell settings tonight (if you haven't already).

@seanpoulter
Copy link
Member Author

seanpoulter commented Feb 25, 2018

I'll close this too since it's not really a bug anymore.

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