You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The actual setup is just not fully compatible with Babel 7, when running yarn test with the following test case (the only thing I added to the project was that test case) an error occurs with Babel:
yarn run v1.7.0
$ jest
FAIL src/__tests__/App.test.js
● Test suite failed to run
Plugin 0 specified in "node_modules/babel-preset-react-native/index.js" provided an invalid property of "default" (While processing preset: "node_modules/babel-preset-react-native/index.js")
at Plugin.init (node_modules/babel-core/lib/transformation/plugin.js:131:13)
at Function.normalisePlugin (node_modules/babel-core/lib/transformation/file/options/option-manager.js:152:12)
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (<anonymous>)
at OptionManager.resolvePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.388s, estimated 2s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So I figured out that jest was using babel 6 and I fixed it by downgrading babel-preset-react-native to 4.0.0, but it could lead to another issue.
And then looking on the babel-jest documentation I found out that if you are using babel 7 you will need to add the package babel-core^7.0.0-0.
Just running yarn add --dev babel-core^7.0.0-0 seems to fix the problem.
Reproducible Demo
Run react-native init and place the code sample bellow in __tests__/App-test.js.
Environment
Description
The actual setup is just not fully compatible with Babel 7, when running
yarn test
with the following test case (the only thing I added to the project was that test case) an error occurs with Babel:The error is described bellow:
So I figured out that jest was using babel 6 and I fixed it by downgrading
babel-preset-react-native
to4.0.0
, but it could lead to another issue.And then looking on the
babel-jest
documentation I found out that if you are using babel 7 you will need to add the packagebabel-core^7.0.0-0
.Just running
yarn add --dev babel-core^7.0.0-0
seems to fix the problem.Reproducible Demo
Run
react-native init
and place the code sample bellow in__tests__/App-test.js
.The text was updated successfully, but these errors were encountered: