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
Jest encountered an unexpected token: "SyntaxError: Unexpected token {" #5686
Comments
Same here |
you need to read the guide on the jest docs for how to use jest with react-native. or search issues here. or look at the jest config in the example app here - most notably, this line: react-navigation/examples/NavigationPlayground/package.json Lines 42 to 44 in a8c0f83
i can see from the example project you put together that you did not add a transformIgnorePatterns config, so that is the problem. |
if either of you want to contribute a guide to setting up jest once you have figured it out based on the above comment, a pr to the docs would be welcome! react-navigation/react-navigation.github.io#345 |
@brentvatne Do you happen to know what the right |
I have followed the code as presented in #4995 and get the same error. Bizarrely, the "accepted" solution refers to a page regarding testing react-navigation in the context of redux, which neither #4995 mentions nor is required for the parse error to manifest.
I have put the project into a git repo: https://github.com/jyurek/react-navigation-error-replication and all you need to do is clone,
npm install
, andnpm test
to see the error.As for the link in that ticket being correct at the time of posting, it wasn't. This was the page on Sep 15 2018: https://web.archive.org/web/20180915033153/https://reactnavigation.org/docs/en/redux-integration.html
There is also no useful result if I search for "mocking" using the reactnavigation.org search.
For reference, this is the error that occurs. It's a parse error, not a compilation error or runtime error:
The text was updated successfully, but these errors were encountered: