Jest automatically loads and applies our babel configuration. However, because our project takes advantage of tree shaking with webpack, our babel configuration disables compiling modules. For Jest to work on our code, we need to make sure that our babel configuration compiles modules during our tests. We’ll use the NODE_ENV environment variable to generate the proper configuration.


Compile Modules with Babel in Jest Tests