Accepted answer

The above problem can be solved by installing babel-plugin-syntax-class-properties

Followed by installing babel-plugin-transform-class-properties

Combining these two plugins helped me run the test cases successfully.


makeIncrementer = amount => {
    this.setState(prevState => ({
      count: prevState.count + amount,

makeIncrementer function need to be like above.


I have the same problem for a few days and tried different solutions but they doesn't work for me. However mine was fixed by just modifying package.json to have "test": "react-scripts test" or replacing "jest" with "react-scripts test" under scripts just like this: package.json:

"scripts": {
    "test": "react-scripts test",

Related Query

More Query from same tag