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

coverage summary does not show data for 24.0.0 #7734

Closed
SamMaxwell opened this issue Jan 28, 2019 · 8 comments
Closed

coverage summary does not show data for 24.0.0 #7734

SamMaxwell opened this issue Jan 28, 2019 · 8 comments

Comments

@SamMaxwell
Copy link

SamMaxwell commented Jan 28, 2019

🐛 Bug Report

after upgrading to jest 24.0.0 and running "npm test" on my moderate-sized projects no longer show file-level metrics in the coverage summary and the "All Files" aggregates are all 0 (% Stmts, % Branch, % Funcs, %Lines), even though the tests cover the files at 100% for all files. if I simply downgrade to jest 23.6.0 (and change nothing else) then the coverage details show up.

To Reproduce

git clone https://github.com/SamMaxwell/jest-issue-7734.git
npm i
npm test
notice that the coverage summary is wrong
npm uninstall jest
npm i [email protected] --save-dev
npm test
notice that the coverage summary shows the correct metrics

Link to repo

git clone https://github.com/SamMaxwell/jest-issue-7734.git

Expected behavior

The console output has a coverage summary that includes file test coverage data and "All Files" aggregates that aren't all 0

@thymikee
Copy link
Collaborator

Would you mind setting a repro we can test?

@SamMaxwell
Copy link
Author

@SamMaxwell
Copy link
Author

npm i (to get jest 24.0.0)
npm test (see that the coverage metrics are all 0)
npm uninstall jest
npm i [email protected] --save-dev
npm test (see that the coverage metrics are all 100)

@SamMaxwell
Copy link
Author

I think 24.0.0 messed up coverage in general. I even commented out some tests to see if it would report the uncovered lines and it still did not report anything. (but works as expected in 23.6.0)

@grosto
Copy link
Contributor

grosto commented Jan 28, 2019

The problem is with collectCoverageFrom.
Jest uses library micromatch for glob matching. It got updated(#6650) to a new version in Jest 24. This new version does not match with .js files with the pattern from your config('**/*.{js}').

I have reproduced this in the repl below:
https://repl.it/repls/BlankNotableAbility

If you change the pattern to '**/*.js' or '**/*.{js,}', it will work.

@thymikee
Copy link
Collaborator

Thanks @grosto for checking that out. Yup we've upgraded micromatch to v3, so make sure your globs are valid.

@SamMaxwell
Copy link
Author

Thanks @grosto and @thymikee, the new globs made it work as expected

@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.
Projects
None yet
Development

No branches or pull requests

3 participants