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

create-react-app #113

Closed
mohammedzamakhan opened this issue May 23, 2017 · 11 comments · Fixed by #162
Closed

create-react-app #113

mohammedzamakhan opened this issue May 23, 2017 · 11 comments · Fixed by #162
Assignees

Comments

@mohammedzamakhan
Copy link

screen shot 2017-05-23 at 11 53 47 am

@tomtobac
Copy link

Does your test script has the flag: --env=jsdom ?

@mohammedzamakhan
Copy link
Author

mohammedzamakhan commented May 25, 2017

Yes it does @tomtobac, when I run npm run test in terminal, it works fine, but doesn't work in vscode

@orta
Copy link
Member

orta commented May 25, 2017

vscode-jest does not run npm run test - it runs Jest directly, you'll need to change your jest.pathToJest to be npm run test

@milesxu
Copy link

milesxu commented May 29, 2017

I have got the exactly same error.
If I set jest.pathToJest to npm run test, the output is Exception raised: Process failed: spawn npm ENOENT

@ingro
Copy link

ingro commented Jun 6, 2017

Same errore here Exception raised: Process failed: spawn npm ENOENT when setting jest.pathToJest as npm run test with create-react-app...

@silentdragonz
Copy link

Just ran into this problem as well. If you're on windows try setting the jest.pathToJest to npm.cmd run test -- or yarn.cmd test --. Node's spawn doesn't find bat files automatically.

@ingro
Copy link

ingro commented Jun 8, 2017

Thanks for your suggestion @silentdragonz , now my tests ran through vscode-jest and I can see inline error messages, but only if I set npm.cmd run test --, not with yarn.cmd.

Anyway one thing I'm missing looking at the example gif are suggestions, but I'm not sure they are part of this package?

@silentdragonz
Copy link

silentdragonz commented Jun 8, 2017

@types/jest is the only thing I had to install to get Jest suggestions.

@mindjuice
Copy link

I've tried setting jest.pathToJest to npm test -- as suggested in the docs, as well as a bunch of other variations, but I always get Exception raised: Process failed: spawn node_modules/.bin/jest ENOENT, no matter what I set for jest.pathToJest, as if it's not looking at it at all. I'm on a Mac, not Windows, so the npm.cmd doesn't apply.

My npm scripts contains "test": "react-scripts-ts test --env=jsdom", and I'm also using react-scripts-ts instead of the vanilla react-scripts, so I've been starting/stopping the extension manually, but it has never run a test yet.

I'm also using jest-cli and there is no jest in node_modules/.bin/jest, but there is one in node_modules/react-scripts-ts/node_modules/.bin/jest, but that doesn't work either with jest.pathToJest.

@xavierfuentes
Copy link

This might be a stupid question but in my case, the output of the Jest plugin only shows this

Watch Usage
 › Press a to run all tests.
 › Press p to filter by a filename regex pattern.
 › Press t to filter by a test name regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

and it gets stuck in there, I can't press any key...

@iverenshaguy
Copy link

@silentdragonz Thank you so much. Worked like a Charm.

legend1202 pushed a commit to legend1202/vscode-jest that referenced this issue Jun 18, 2023
When a project is bootstrapped with create-react-app using the latest
versions of node/npm, the react-scripts executable is installed in the
top level node_modules/.bin directory. This has been added as the first
path to check.

This fixes jest-community#161, closes jest-community#39, closes jest-community#113 and resolves facebook/create-react-app#2709, and closes jest-community#125.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants