npm install @babel/core babel-jest
./node_modules/.bin/jest
Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
I would like for this to be supported.
Please provide either a repl.it demo or a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
npx envinfo --preset jestPaste the results here:
$ ./node_modules/.bin/jestnpx envinfo --preset jest
-bash: ./node_modules/.bin/jestnpx: No such file or directory
$ npm install jestnpx
npm ERR! code E404
npm ERR! 404 Not Found: jestnpx@latest
npm ERR! A complete log of this run can be found in:
npm ERR! /.../.npm/_logs/2018-06-15T20_00_03_861Z-debug.log
We're seeing this too, here's the output of our envinfo:
npx envinfo --preset jest
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Binaries:
Node: 9.11.1
Yarn: 1.5.1
npm: 5.6.0
npmPackages:
jest:
wanted: ^22.4.2
installed: 22.4.3
It does work with babel 7, please read the docs: https://facebook.github.io/jest/docs/en/getting-started.html#using-babel
It doesn't work with Babel 7 following the docs.
npm install babel-core@^7.0.0-0 --save-dev
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected]
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
@lloydjatkinson, while this doesn't solve your problem, to install babel 7+ you have to include the @ prefix
npm i @babel/[email protected]
I have to agree with @lloydjatkinson.
I'm no stranger to babel configs, but this definitely does not work. I'm trying one final Hail Mary of clearing out all my node modules and cached versions, but my hopes are very low.
I'm using a babel.config.js file. Is this a potential problem? If this is not the cause, I have to conclude that the documentation for Babel 7 is insufficient or wrong.
@paulcbetts, were you able to get this working?
If you think there's an issue after following the docs, please open up a new issue with a clear reproduction (setting up a small repo would be the best, this issue provided no such thing). Just saying "doesn't work" gives us nothing to go on, since it _does_ work (we use at at work). Seeing a misconfiguration might give us a good idea on how to improve the docs 馃檪
Here is the new issue with a minimal repo: https://github.com/facebook/jest/issues/6662
Most helpful comment
It doesn't work with Babel 7 following the docs.