Jest setup “SyntaxError: Unexpected token export”

前端 未结 4 1732
迷失自我
迷失自我 2020-12-24 11:31

I\'m implementing tests into an existing project that currently has no tests. My tests are failing to compile node_modules/ imports.

/Users/me/m         


        
4条回答
  •  伪装坚强ぢ
    2020-12-24 11:39

    For create-react-app users who are looking for a fix, here's what worked for me:

    // package.json
    ...
      "jest": {
        "transformIgnorePatterns": [
          "/node_modules/(?!lodash-es)"
        ]
      },
    ...
    

    Overriding options in jest.config.js file didn't work for me. Keep in mind that not every option can be overridden, here's a list of supported options: https://create-react-app.dev/docs/running-tests#configuration

提交回复
热议问题