davelosert/vitest-coverage-report-action

Display Trend indicator

Closed this issue · 6 comments

inomn commented

Hi! Is it possible to display a Trend indicator (diff) related to current PR? ⬆️ \ ⬇️

Example:
image

Hi @inomn,

thank you for the suggestion. I also already thought about this, but got stuck in how to best get the comparison data. Best would be to run the tests twice - once for the current branch and then again for the target branch.

However, currently this library does not execute tests itself but builds on the user providing the reports from previously executing it. So it is a bit of a major addition and probably requires a bit of a rewrite.

I'll happily accept a PR doing this as I don't know when I will be able to get around to do this.

goibon commented

It would be really cool to have this feature. Do you think it could make sense to try and keep with the current API of this library and have consumers pass in two coverage files that they would like to compare?
This would enable this library to remain agnostic about things like how consumers like to run their tests and which version of their code they would like to diff against.

@goibon: Yep, great idea. I was thinking about this as well, together with some documentation on how to get the comparison json (or even having another action that does it).

But being able to process it after all is the first step anyways, no matter later steps to provide the comparison data.

I'll see what I can do end of the week to get this in.

jest-coverage-report-action supports comparing coverage with the base branch.

@tran-simon: Yes I know - but the jest-coverage-report-action (currently) works fundamentally different from this action in that it executes the test-commands by itself while this action only takes the finished reports. Also, for the comparison data, the jest-coverage-report-action uses a git checkout for the target-branch and then re-execute the tests to get the comparison data.

When creating this action, I also had a deep look at jest-coverage-report-action to see if I could just reuse it. I decided against replicating it for vitest as I didn't (and still don't) have the time to support a library of that size and feature-set, at least not from the beginning. And by the time I created this action, it's current (simple) features were enough for my use-cases.

That being said, today, I'd love to see some more features of the jest-coverage-report-action in this action (e.g. coverage trends, test result reporting, failing test annotations) and I'll always happily accept PRs for those. 🙂

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀