-
-
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
Code coverage is including .svg file #2632
Comments
This is unrelated to coverage. You are trying to import an svg file which you cannot do in node.js. Check out the tutorial here: http://facebook.github.io/jest/docs/tutorial-webpack.html#content |
Ever find a solution? Having this exact issue. |
Did you try the link in the post above yours? |
Unfortunately that link is dead. There is also #2663, but although i tried the solutions there i had no luck so far. |
Oh, that's not good. Correct link is http://facebook.github.io/jest/docs/en/webpack.html /cc @ericnakagawa is the "tutorial" part of the url gone on purpose? Is it possible to set up custom redirects? |
Thanks. I gave an update at #2663 (comment) because it is still not working for me. |
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 essentially the default app generated by
create-react-app
, but with some packages added to enable React testing for Jest (and test file moved into__test__
).If I run
jest --coverage
everything works properly, however, if I add the following line to myApp.js
file, I get an error from running the same command:import logo from '../../public/images/logo.svg';
The error is:
I assume this is because jest is incorrectly trying to check code coverage for the
.svg
file.I tried adding some config to my
package.json
to prevent it from looking at.svg
files:That seemed to let it get further, as it now shows this error:
How can I prevent Jest from including
.svg
files in the coverage check?The text was updated successfully, but these errors were encountered: