zyborg / pester-tests-report

GitHub Action to run Pester tests and generate report attached to Workflow Run
MIT License
40 stars 13 forks source link

Code Coverage #11

Closed natescherer closed 3 years ago

natescherer commented 3 years ago

Okay, I have functional code coverage added. It uses the same functionality as the primary test report vis-a-vis posting the results via check run and badge and test results to the gist.

I'm happy with the code coverage testing functionality itself but I'm less happy with the report generated. I used https://github.com/danielpalme/ReportGenerator to convert from the JaCoCo to a text format and generate a code coverage badge. Unfortunately, it doesn't have markdown output (couldn't really find anything that would do JaCoCo to MD), and the HTML outputs it generated were too big for check runs or seemingly Gists.

The best way to generate the report would probably be doing an XSL based translation to Markdown like you are doing for the test reports, but I'm afraid that's outside of what I know how to do and I don't have time to learn at this moment.

Perhaps this could just be regarded as a first pass at code coverage with better report formatting coming in the future?

Here's an example of the outputs:

https://github.com/natescherer/PoshEmail/actions/runs/733609157 https://gist.github.com/natescherer/797ca586d176e0af436182c772e35c24

I would welcome your thoughts and comments.

natescherer commented 3 years ago

Alternate option I just thought of: scrap the in-action coverage file conversion and recommend using a third-party service like codecov.io. I just did some initial testing and it consumes and reports on pester code coverage files just fine with a little massaging.

natescherer commented 3 years ago

Update: don't merge this yet. I've got the bones of an XSLT working for jacoco. ReportGenerator mysteriously stopped installing on Windows agents and I decided to take another crack at it.

natescherer commented 3 years ago

Okay, this is now ready to merge and I have no qualms with how this works! XSL was easier to learn than I anticipated.

See https://gist.github.com/natescherer/120b8e0b4fa7a2a68ba69f7ddc2c5b0a for example output.

ebekker commented 3 years ago

This looks awesome, thanks for the contribution!