Jest gives an error: “SyntaxError: Unexpected token export”

前端 未结 4 1370
不知归路
不知归路 2020-12-17 08:45

I\'m using Jest to test my React app.

Recently, I added DeckGL to my app. My tests fail with this error:

Test suite failed to run

/my_project/node_         


        
4条回答
  •  执笔经年
    2020-12-17 09:06

    And if you are using 'create-react-app', it won't allow you to specify 'transformIgnorePatterns' via Jest property in package.json

    As per this https://github.com/facebook/create-react-app/issues/2537#issuecomment-390341713

    You can use CLI as below in your package.json to override and it works :

    "scripts": { "test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!your-module-name)/\"", },

提交回复
热议问题