Skip to content

babel-jest plugin & babel 7 incompatibility #5525

@alechp

Description

@alechp

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
babel-7-jest does work for me.
babel-jest does not work for me.

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?
When I run test suite using babel-7-jest:
screen shot 2018-02-11 at 11 19 42 am

When I run test suite using babel-jest:

 TypeError: Cannot read property 'loose' of undefined (While processing preset: "/Users/alechp/Code/servexyz/repospace/cli/node_modules/@babel/preset-env/lib/index.js")

All that is required to make these tests pass is toggle the "transform" option in Jest config from "babel-jest" to "babel-7-jest" (note: I have both installed right now for easy swapping, but I have tried executing babel-jest after having removed babel-7-jest from dependencies and clearing cache)

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

Relevant dependencies, jest configuration and babel configuration

"devDependencies": {
    "@babel/core": "^7.0.0-beta.39",
    "@babel/node": "^7.0.0-beta.39",
    "@babel/preset-env": "^7.0.0-beta.39",
    "babel-7-jest": "^21.3.3",
    "babel-jest": "^22.2.2",
    "jest": "^22.2.2"
  },
  "jest": {
    "verbose": true,
    "bail": false,
    "collectCoverage": false,
    "modulePathIgnorePatterns": ["sandbox", "node_modules"],
    "transform": {
      "^.+\\.jsx?$": "babel-jest"
    }
  },
  "babel": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "targets": {
            "node": "9.3.0"
          }
        }
      ]
    ]
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions