Skip to content
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

Empty coverage is not generated correctly #7302

Closed
mengdage opened this issue Oct 30, 2018 · 2 comments · Fixed by #7388
Closed

Empty coverage is not generated correctly #7302

mengdage opened this issue Oct 30, 2018 · 2 comments · Fixed by #7388

Comments

@mengdage
Copy link
Contributor

🐛 Bug Report

When a file is not covered by any unit tests, jest consider it as a untested file and generate empty coverage for it. However, these files are instrumented by babel without using babel-plugin-istanbul. Therefore, if they use ES6. The coverage data is not correct.

To Reproduce

I created a repo to reproduce the bug. https://github.com/mengdage/jest-empty-coverage-bug

In that repo, the file BrandTable.jsx uses ES6 and the empty coverage generated for it is not correct.

Expected behavior

The empty coverage for BrandTable.jsx is incorrect.

Link to repl or repo (highly encouraged)

https://github.com/mengdage/jest-empty-coverage-bug

@mengdage
Copy link
Contributor Author

mengdage commented Oct 30, 2018

I am working on a solution. See this PR for details. It fixes my problem. But I'm not sure if it would break anything because the I don't fully understand the purpose of the original code. Why does it choose not instrumenting the code when transforming, and then instrument it afterwards?

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant