-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 import, testing ES6 typescript components #4263
Comments
You have your answers on SO already. {
"presets": [["es2015", { "modules": false }], "react"],
"env": {
"test": {
"presets":[
"es2015",
"stage-0",
"react"],
"plugins": [
"transform-es2015-modules-commonjs",
"dynamic-import-node"
]
}
}
} Normally you want babel not to compile imports, because Webpack understands that. But for tests, you need to compile modules to common js (which is the default of "es2015" preset) |
even with copying your example babel config I get the same Unexpected token import error, there has to be something else that's not right, the answers on SO also do not work for me |
have you tried running |
Yeah I tried that too, I have seen |
I'm having this issue, but |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I've read the docs, read blog posts, read multiple stack posts and i can't find any solution that has worked for me.
Jest docs for example about how to test react components makes it look like testing an ES6 component should just work. But doesn't for me and I have no idea if it's because my files are using typescript or not.
So I would like some help please, seems like a popular issue imo with no reliable solution.
More detail on my code and configs can be found on my stackoverflow post or if you prefer my repo is here
Thanks
The text was updated successfully, but these errors were encountered: