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

Fix support for create-react-app and react-scripts #161

Closed
seanpoulter opened this issue Nov 4, 2017 · 2 comments · Fixed by #162
Closed

Fix support for create-react-app and react-scripts #161

seanpoulter opened this issue Nov 4, 2017 · 2 comments · Fixed by #162
Assignees

Comments

@seanpoulter
Copy link
Member

This is a new issue to aggregate existing issues for supporting create-react-app and react-scripts. The latest node LTS version doesn't install Jest where it's currently expected (in src/helpers.ts). This seems to be the cause of #39, #41, #113, and #125.

--

Environment

  1. node -v: 8.9.0

  2. npm -v: 5.5.1

  3. npm ls react-scripts (if you haven’t ejected): N/A

  4. Operating system: Windows 7

  5. Extension version: v2.4.1 as of 23af6f0

Steps to Reproduce

The create-react-app User Guide has a section for Updating to New Releases. Instead of installing newer versions of react-scripts, I've used this approach to bootstrap app with each supported version (>= v1.0.0) and confirm the extension doesn't work.

create-react-app app
cd app
npm uninstall react-scripts
npm install "react-scripts@<version>"
code --extensionDevelopmentPath=<...\vscode-jest> .

Expected Behavior

The extension should detect the bootstrapped app.

Actual Behavior

An "Unexpected token" error is thrown when Jest runs without detecting this has been bootstrapped.

2017-11-04 -- vscode-jest -- unexpected token

Suggested Changes

  • Maintain the existing check to support older versions of node/npm
  • Detect react-scripts in node_modules/.bin/react-scripts(.cmd)?
@nickserv
Copy link

nickserv commented Apr 29, 2018

I'm getting the Unexpected token error on JSX using react-scripts 1.1.4. Setting jest.pathToJest to npm test -- as a workaround fixes it, but shouldn't it be automatic?

@badsyntax
Copy link

@nickmccurdy thanks for the workaround. @orta this still seems to be an issue BTW, the test runner is using jest directly, instead of going through react-scripts.

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.
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.

3 participants