Open davegomez opened 6 years ago
I believe it'd work if you install babel-core
bridge yarn add babel-core@7.0.0-bridge.0 --dev
What this does is proxy babel-core
to @babel/core
.
It didn't work @timneutkens. I'm getting the same error as before:
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
I'm already using babel 7, and tried running everything with Babel 6 too but it didn't work either.
This is the repo in case you wanna try it https://github.com/davegomez/silky-react-table
I've been trying to use this Nextjs config to create the github page for my library and also I'm using Jest as a test runner but I have found that if I change my .babelrc file to use it as a JavaScript file instead of JSON it seems Jest doesn't recognize the file and can't use Babel for my tests.
The Jest config I need is as simple as this:
And the config I mage to use with this Nextjs example is this:
Any idea how can I keep the JSON .babelrc and use your example at the same time or is it possible to use a babelrc.js file with Jest? I haven't found a way to do it 😔