we were using jest from unit testing in react-native. It was working well. We just deleted npm and installed it again and then when we tried to run unit test(npm test) we are getting following error and we are not able to run test cases.
What might have went wrong.
React 17+
"devDependencies": {
"@testing-library/dom": "^8.11.1",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.24",
"@types/react": "^17.0.27",
"@types/react-table": "^7.7.7",
"jest": "26.0.1",
"ts-jest": "26.0.0",
"typescript": "^4.5.4"
}
Error was on jest 27+ version but after setting to 26 it works well.
Try to re-install both jest and jest babel last versions
npm install --save-dev jest
npm install --save-dev babel-jest regenerator-runtime
And re-run the test, it works for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With