Closed nakita-strangeways closed 5 years ago
I ran into the same thing. Seems like there's an incompatibility between the most recent version of Jest and babel-core 6.26.3 (since in the video, he has you install the most recent version of Jest with npm install -D jest react-test-renderer
).
You'll want to go to the package.json for the "testing" branch and see if the versions match what you have. Once I changed "jest" back to "^23.5.0", it worked (yours is probably "^24.1.0":
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"eslint": "^5.12.1",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.0",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"jest": "^23.5.0",
"parcel-bundler": "^1.11.0",
"prettier": "^1.16.1",
"react-test-renderer": "^16.8.3"
},
@btholt maybe it is possible to add this info to the video description here: https://frontendmasters.com/courses/intermediate-react/jest-snapshot-tests/
Example:
"Learn to run your first Jest [...] Note to install jest version
^23.5.0
to prevent issue 28
I run npm install --save-dev jest and it worked with version ^23.6.0
We just updated the annotation, code and website to point to ^23.5.0
https://btholt.github.io/complete-intro-to-react-v4/testing/
Thanks for your help all 🙌 @nakita-strangeways @the-nick-wilson @gitbreaker222 @Thomaspantioras !
When starting the Jest Snapshot Tests, the debug says "snapshot missing" in the Details.test.js, and when I run npx jest in my terminal, it fails and gives me:
.
Ive cloned the repo and gone on straight from there, any ideas?