babel@7 and jest configuration

后端 未结 4 2069
孤街浪徒
孤街浪徒 2021-02-05 07:07

Maybe you may help me? I try to configure jest to use babel@7 So I have:

\"jest\": \"^23.4.1\",
\"@babel/core\": \"^7.0.0-beta.54\",
\"babel-7-jest\": \"^21.3.3\         


        
4条回答
  •  猫巷女王i
    2021-02-05 07:36

    You can find a working example and tutorial over here.

    These are all my Babel packages:

    "@babel/core": "^7.1.2",
    "@babel/node": "^7.0.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-react": "^7.0.0",
    "@babel/register": "^7.0.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "^23.6.0",
    "babel-loader": "^8.0.4"
    

    And I had to install babel-core@^7.0.0-bridge.0 like it is mentioned on the Jest website.

    My .babelrc:

    {
      "presets": [
        "@babel/preset-env",
        "@babel/preset-react"
      ]
    }
    

    And my npm script: jest --config ./test/jest.config.json It didn't change for the Babel 7 upgrade.

提交回复
热议问题