Jest not preprocessing my JSX

前端 未结 4 1920
野性不改
野性不改 2020-12-17 09:47

I am following the Jest tutorial to test a react component and am running into preprocessing issues with my jsx. I assume the error is due to preprocessing, the error messag

4条回答
  •  Happy的楠姐
    2020-12-17 10:36

    I had a similar problem, and the solution was adding this to jest config file:

    "transform": {
          "^.+\\.js$": "babel-jest",
          "^.+\\.jsx$": "babel-jest"  // This line was missing
    }
    

    The reason it was needed in our project, is because we overridden the default "transform" value in jest config file.

提交回复
热议问题