问题
I am facing this issue. after running my unit test. This same error occurs wherever the static variable present. do you have any solution for this? or what causing this issue
similarly, the same error showing for the auto binding too.
ex:
handle = ()=>{
}
回答1:
finally, I found the solution.
add this below lines in the babelrc file
"presets": ["env", "react"],
"plugins": ["transform-class-properties"]
And also if someone facing below issue, Kindly check your node version. it should be 8+ version. Because I faced this issue.
...this.state is undefined
^^^
来源:https://stackoverflow.com/questions/51076668/jest-encountered-unexpected-token