test_runner: avoid coverage report partial file names
Fixes: https://github.com/nodejs/node/issues/51299
I noticed that the issue has been stalled for months, even though a PR with the solution was practically accepted. I removed some duplication and fixed a small bug (which caused empty lines to be printed, breaking the table), but otherwise, I used the initially accepted proposal.
P.S.: I've included the user who initially started the work as a co-author.
P.P.S.: I'm wondering if it might make sense to move the report generation out of the utils
file. Given the amount of logic involved, it could be beneficial to place it in a separate file to increase cohesion.
P.P.P.S.: I noticed that no tests were added in the current PR because it should already be covered, but I wonder if it might be worth creating specific unit tests for getCoverageReport
.
EDIT: I changed the implementation proposing a tree view instead of a multiline, for this reason I removed the co-author.