question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flag to prevent Jest from using babel.

See original GitHub issue

I have a post on stack overflow about having jest ignore the babel config.

I just also upgraded to babel-7 and I am getting issues. I saw this doc about using babel-jest.

Again as I state below, my code runs in node 9 I don’t need babel to run my tests, why is jest forcing me to use it?

From StackOverflow:

I am getting this error:

Couldn’t find preset “env” relative to directory

I have jest in a package with babel, the babel dependencies are not installed, which is why I am getting this error, but the file I am testing is the source, and with the version of node that I’m running I don’t need to compile, I only have babel in the project to ship the code I’m building as a postinstall script on lesser-versions of node then authored.

How can I shut off jest from forcing babel dependencies from being installed?

Now I’m getting

TypeError: Cannot read property 'loose' of undefined (While processing preset: "/Users/thomas/Project/node_modules/@babel/preset-env/lib/index.js")

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

9reactions
reggicommented, Mar 2, 2018

Could I just use this:

{
  "jest": {
    "transform": {}
  }
}
9reactions
SimenBcommented, Feb 26, 2018

Jest will use babel anyways - it’s how we do coverage.

There are many issues and SO posts containing information on how to turn of the normal transform - please use search.

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel-jest doesn't handle ES6 within modules - Stack Overflow
Jest doesn't seem to have a problem using ES6 imports however as soon as it hits on an import statement within one of...
Read more >
Code Transformation - Jest
While babel-jest by default will transpile TypeScript files, Babel will not verify the types. If you want that you can use ts-jest ....
Read more >
Options - Babel.js
Options can be passed to Babel in a variety of ways. ... Babel and pass capability-related flags for use by configs, presets and...
Read more >
babel-preset-jest | Yarn - Package Manager
babel -preset-jest. Babel preset for all Jest plugins. This preset is automatically included when using babel-jest. Install. $ npm install ...
Read more >
Setup - Testing Library
If you're using the Jest testing framework version 24 or lower with the default configuration, it's recommended to use jest-environment-jsdom- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found