-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: val.entries is not a function when testing for image src #5295
Comments
@EdmundMai In which version of Jest did the error occur? This might be a duplicate of #4922 which was fixed in #4935 available in Jest 22. |
Hi @pedrottimark ! This is what is printed when I type
I remember reading somewhere that I needed to have those versions match... but when I made them match at 20.0.3 I think I saw another error. Would it be safe to just update Jest to v22? Here's my package.json file by the way:
(Thanks for your help in advance) |
Here's what happens when I upgrade to Jest v 22:
|
When using CRA it's not supported to install your own version of jest (#5119 (comment)). Do you still get the same error after removing |
@EdmundMai Here is a procedure that I have used to temporarily uneject on a branch to upgrade Jest until create-react-app catches up, if you dare to void your warranty :) https://speakerdeck.com/pedrottimark/uneject-and-recreate-reactjs-charlotte |
@SimenB After I remove jest from my devDependencies, I get this:
When I try downloading v21.x (got this idea from: https://stackoverflow.com/questions/46220674/jest-typeerror-path-must-be-a-string-received-undefined), it gives me this error:
|
Again, you cannot install your own version of jest when using CRA.
|
@SimenB Great idea, just pushed a demo: https://github.com/EdmundMai/jest-demo Run |
@EdmundMai Your issue is that Your issue is on the CRA side, as you want to use some config they do not allow. I think you should open up an issue with them. |
@SimenB You're a life saver!!!!!! Thanks so much for all your help!! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a Logo component:
Test file:
But when I run the test, there is some weird error:
How am I supposed to test that the image src === "assets/images/logo.png"?
The text was updated successfully, but these errors were encountered: