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

No coverage reports #2090

Closed
bitPogo opened this issue Oct 29, 2020 · 27 comments · Fixed by #2108
Closed

No coverage reports #2090

bitPogo opened this issue Oct 29, 2020 · 27 comments · Fixed by #2108

Comments

@bitPogo
Copy link

bitPogo commented Oct 29, 2020

💥 Regression Report

After updating from 26.4.0 -> 26.4.2, I get no more a valid coverage report in jest.

Last working version

Worked up to version: 26.4.0

Stopped working in version: 26.4.2

To Reproduce

Steps to reproduce the behavior:

  1. write your app with tests
  2. run the coverage report in jest (jest --coverage) with version 26.4.0
  3. update to 26.4.2
  4. run the coverage report again

Expected behavior

The coverage report should be shown as in version 26.4.0

envinfo

System:
    OS: MacOS 10.15.7

Npm packages:
    jest: 26.4.2
    typescript: 4.0.3
   @babel/core :  ^7.12.3 ,
   @babel/plugin-syntax-jsx :  ^7.12.1 ,
   @babel/preset-env :  ^7.12.1 ,
   @babel/preset-react :  ^7.12.1 ,
   @babel/preset-typescript :  ^7.12.1 ,
   babel-loader :  ^8.1.0 ,
@ahnpnl
Copy link
Collaborator

ahnpnl commented Oct 29, 2020

duplicate with #2080 , please check the solution there

@ahnpnl ahnpnl closed this as completed Oct 29, 2020
@bitPogo
Copy link
Author

bitPogo commented Oct 29, 2020

Maybe there this is a duplicate but not of the issue you refer to.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Oct 29, 2020

does it work if you clear jest cache ?

@bitPogo
Copy link
Author

bitPogo commented Oct 29, 2020

I cleared the cache, but it did not helped it...I tried several (to many to recall them all) things to bring it back, but only after the downgrade to 26.4.0 it worked again.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Oct 29, 2020

clear cache works for me with 26.4.3. What I did is:

  • Upgrade to 26.4.3
  • Run yarn jest --clearCache
  • Run test again and coverage shows.

I actually linked the wrong duplicated issue, already corrected the comment.

@bitPogo
Copy link
Author

bitPogo commented Oct 29, 2020

I will check it out by tomorrow and report back. Thanks so far!

@bitPogo
Copy link
Author

bitPogo commented Nov 1, 2020

Confirmed, it works! Thanks again!

@arty-name
Copy link

I have found that clearing the jest cache only fixes the coverage for a single run of jest. Following jest runs produce no coverage again. Clearing the cache before every jest run doesn't sound like a viable solution. Would you consider that an issue @ahnpnl?

@ahnpnl ahnpnl reopened this Nov 4, 2020
@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 4, 2020

Ok that is more than an issue indeed.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 4, 2020

@arty-name for some reasons I cannot reproduce anymore this issue with jest 26.6.3 and ts-jest 26.4.3.

Updated: ok I managed to get one reproduce scenario. Some repos I don't see the issue, weird.

@kamilmielnik
Copy link

kamilmielnik commented Nov 4, 2020

I'm also experiencing this issue. (26.4.0 & 26.4.3).
It's weird, it's not 100% deterministic.
Doing npx jest --clearCache (as per advice above) didn't have any effect for me.
Using --no-cache flag for all my scripts using jest CLI did the trick.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 4, 2020

@kamilmielnik same here, yesterday I could reproduce with one repo. Today the same repo, not reproducible anymore. Clear cache always fixes the issue.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 4, 2020

@arty-name @kamilmielnik I have published 26.4.4-alpha.0 at tag next. Would you guys please try and let me know ?

@arty-name
Copy link

It would have been embarrassing if you didn't mention the same thing before, but now I, too, cannot reproduce this issue even though I did no changes to the project. I tried with the alpha version, rolled back to the published version - no issues anymore. 🤷‍♂️

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 5, 2020

@arty-name does alpha version always work for you ?

@arty-name
Copy link

I didn't have any issues with it so far

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 5, 2020

I will leave it for a few days, let me know if anything happens :)

@freshly-pressed-trousers

We encountered this today, no combination of jest versions, ts-jest versions (including next or 26.4.0) or clearing cache could get it to work.

This was on MacOSX running node v12.16.3; I'm happy to try any variations locally to try and help diagnose.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 5, 2020

Remove node_modules maybe ? I cannot reproduce it always either. It happens randomly for me. If 26.4.0 doesn't work, it will be jest issue.

@thankyouveryfun
Copy link

It also started happening for me. We run 3000 tests with jest and 860 with karma.
At the end we merge coverages using nyc. After upgrade to ts-jest 26.4.3 issue started ocurring all the time regardless of the jest version

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 5, 2020

@Milancos you can try with next tag to see if it helps

@thankyouveryfun
Copy link

@ahnpnl issue didn't occur again with 26.4.4-alpha.0

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 5, 2020

The 26.4.4-alpha.0 will stay for a few days. Please test and let me know if it is stable.

@freshly-pressed-trousers

Remove node_modules maybe ? I cannot reproduce it always either. It happens randomly for me. If 26.4.0 doesn't work, it will be jest issue.

Updated to next and ran:

rm -rf node_modules && npm i && node_modules/jest/bin/jest.js --clearCache && npm run test:coverage

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |
----------|---------|----------|---------|---------|-------------------

Still occurring, same on our CI runs. What version of jest have people managed to get it working with? I can try with the same jest version to try and narrow down the variables.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 6, 2020

@freshly-pressed-trousers your case is about collectCoverageFrom is not configured properly I think

@freshly-pressed-trousers
Copy link

freshly-pressed-trousers commented Nov 6, 2020

Bingo!

Had collectCoverageFrom down as "src/*.ts", should have been "src/**/*.ts", bloody globs always trip me up! Thanks for your time & help. <3

Can confirm it works on my env with "next" now

@brunolnetto
Copy link

Hi fellows,

I have the same issue as you on my repository: https://github.com/web-needle/sappio . Would you please help me fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants