jest-coverage-comment icon indicating copy to clipboard operation
jest-coverage-comment copied to clipboard

Introduce relative coverage change info

Open paescuj opened this issue 3 years ago • 12 comments

The report will now include information about the relative change in coverage when the previous coverage value is passed along with the file input. For example, if the coverage info is stored in a gist (for the badge), this value can be read out and passed to this action.

coverage-summary-path: ./coverage/coverage-summary.json, 60
multiple-files: |
  title1, ./data/coverage_1/coverage-summary.json, 60
  title2, ./data/coverage_1/coverage-summary_2.json, 90

ToDo:

  • [ ] Update documentation

Example with single file

Lines Statements Branches Functions
Coverage: 78%
■ Unchanged
76.74% (33/43) 100% (0/0) 33.33% (2/6)

Example with multiple files

Title Lines Statements Branches Functions
title1 undefined: 78%
▲ Increased (+18%)
76.74% (33/43) 100% (0/0) 33.33% (2/6)
title2 undefined: 79%
▼ Decreased (-11%)
77.27% (34/44) 100% (0/0) 33.33% (2/6)

paescuj avatar Oct 28 '22 23:10 paescuj

Thanks for contributing, it's a great feature 💪 I will wait for you to merge from main and resolve the conflicts, so I can see the actual changes.

MishaKav avatar Oct 30 '22 20:10 MishaKav

Maybe this change may be represented in one line?

Example with multiple files

Title Lines Statements Branches Functions
title1 undefined: 78%(+18%) 76.74% (33/43) 100% (0/0) 33.33% (2/6)
title2 undefined: 79%(-11%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)

MishaKav avatar Oct 30 '22 20:10 MishaKav

Thanks for your positive feedback!

Maybe this change may be represented in one line?

I like this idea! 👍 I'm going to adjust it accordingly.

paescuj avatar Oct 31 '22 15:10 paescuj

@MishaKav Which of these two variants do you like more?

Title Lines Statements Branches Functions
title1 undefined: 79% ■ (±0%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)
title2 undefined: 79% ▲ (+18%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)
title3 undefined: 79% ▼ (-11%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)
Title Lines Statements Branches Functions
title1 undefined: 79%■ (±0%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)
title2 undefined: 79%▲ (+18%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)
title3 undefined: 79% ▼ (-11%) 77.27% (34/44) 100% (0/0) 33.33% (2/6)

I don't quite like the first variant because the text is not centered vertically along with the badge. I was able to fix that in the second variant. But as you can see, it now has a space in between...

paescuj avatar Nov 01 '22 09:11 paescuj

Which of these two variants do you like more?

I like more the second way, even this with space.

I think another improvement may be to represent the Increased with some green icon (example 🟢) and Decreased with red icon (example 🔴) because they usually represent these metrics (but no sure, if it's better)

MishaKav avatar Nov 01 '22 15:11 MishaKav

This is some great work! Can we get this in and a new version released please?

khause avatar Feb 07 '23 23:02 khause

Sorry, haven't been able to finish this over the last weeks! I'll try to do so this weekend 👍

paescuj avatar Feb 08 '23 08:02 paescuj

Could I help in some way to get this over the line?

khause avatar Feb 25 '23 00:02 khause

@paescuj @MishaKav is there anything I can do to help this PR get completed?

khause avatar Apr 20 '23 08:04 khause

Hmm thanks I had some different ideas for the final implementation, but I have to take a look at it again. I really intend to complete this pull request, hopefully I'll have time to do so this weekend 👍

paescuj avatar Apr 20 '23 10:04 paescuj

This would be very nice to have :)

mindrunner avatar May 27 '23 12:05 mindrunner

this is a cool feature. Any updates on when this will be completed/merged?

aviralpostman avatar May 23 '24 08:05 aviralpostman