-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Closed
Description
Is this a bug report?
Yes, it's a bug report.
Can you also reproduce the problem with npm 4.x?
Yes, the bug occurs using NPM 5.3.0 and 4.6.1 also.
Which terms did you search for in User Guide?
Jest, scoped, es6
Environment
node -v: 8.3.0npm -v: 5.3.0yarn --version(if you use Yarn): 0.27.5npm ls react-scripts(if you haven’t ejected): 1.0.11
Then, specify:
- Operating system: Ubuntu Linux
- Browser and version (if relevant): N/A
Steps to Reproduce
- Create a new app by running
create-react-app - Install scoped NPM package which uses ES2015 modules, e.g. by running
yarn add @material/checkbox - Import a module from said scoped NPM package, e.g. by adding the following line to src/App.js:
import MDCCheckboxFoundation from '@material/checkbox/foundation'- Run
yarn test, (pressato run all tests,) and observe error output in console.
Expected Behavior
The tests should run without any errors occuring.
Actual Behavior
The test runner fails with an exception such as this:
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at Object.<anonymous> (src/App.js:4:19)
at Object.<anonymous> (src/App.test.js:3:12)
Reproducible Demo
Example project:
https://github.com/gyorgy-farkas/cra-jest-issue-170811
Steps to reproduce:
- Check out repository.
- Run
yarnto install dependencies. - Run
yarn testto see test runner throw error.
Metadata
Metadata
Assignees
Labels
No labels