-
Notifications
You must be signed in to change notification settings - Fork 192
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 (babel) fails if using ES6 imports #658
Comments
@jounii overrides: [
{
test: /__tests__/,
plugins: [['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }]]
}
] |
Thanks. Your example pointed to right direction, however it was not enough because the jest is running and parsing all sort of files. Only common here was that it is running inside node. So not sure if it is correct way, but this seems to work for now at least:
|
@jounii Looks a bit hacky, you can alternatively try this: env: {
test: {
plugins: [['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }]]
}
} It should work for every file if it's being run by Jest, which sets |
Thanks, that looks better solution and works too. Not familiar with babel config that well, but makes sense now how it works. |
In next release of |
Environment
devDependencies:
Node v12.4.0
Description
After changing
babel.config.js
preset@haul-bundler/babel-preset-react-native
jest tests don't support import syntax anymore. If switching back tometro-react-native-babel-preset
jest works again.Trying to figure out what setting is triggering this, but not expert in babel configuration.
Getting errors such as
The text was updated successfully, but these errors were encountered: