-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
SyntaxError: Unexpected token ... when run jest tests #5532
Comments
Hey maksimr, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
I have the same issue. I don't understand much of the whole babel transformation pipeline, but if you open the preprocessor.js refrenced in your That means the contents of the react-native npm package is not transformed, while it uses the spread operator in the main file in line 114. (I found this by removing all calls to I have no idea what this all means or what the intention for this code was (it was introduced a couple of releases ago already), but so far just commenting out the whole conditional block in |
Even after commenting lines in const React = require('react-native');
console.log(React); // TypeError: Cannot read property 'DEFINE_MANY' of undefined |
@vitalets maybe you should disable jest automock or add some react libraries to "unmockedModulePathPatterns": [
"promise",
"source-map",
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/fbjs",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils"
] |
thanks @maksimr! I will try. |
I'm having this same issue and can't solve it. Suggestions appreciated. |
I having the same issue |
same here. With react16+ |
I try run tests for react-native but seems jest does not play well with ES6
Jest configuration - https://github.com/maksimr/TestAndroid/blob/test-jest/package.json#L10-L27
Test - https://github.com/maksimr/TestAndroid/blob/test-jest/js/components/HelloWorld/__tests__/index-test.js
Module - https://github.com/maksimr/TestAndroid/blob/test-jest/js/components/HelloWorld/index.js
run
npm test
takeError message is not so clear but problem in import and I assume problem with es6
How can I run tests for react-native's es6 code?
Thanks
node --version
v5.4.1
npm --version
3.5.3
The text was updated successfully, but these errors were encountered: