test_runner: refactor coverage report output for readability#47791
test_runner: refactor coverage report output for readability#47791nodejs-github-bot merged 11 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
| } | ||
| return coverage; | ||
| function addTableLine(prefix, width) { | ||
| return `${prefix}${'-'.repeat(width)}\n`; |
There was a problem hiding this comment.
| return `${prefix}${'-'.repeat(width)}\n`; | |
| return `${prefix}${StringPrototypeRepeat('-', width)}\n`; |
also consider memoizing, like https://github.com/nodejs/node/blob/102540aef9024ea6a8218a6d782243f1391612d2/lib/internal/test_runner/reporter/tap.js#L88-97
|
Thanks for this PR, it really improves the output of the coverage report. |
|
@MoLow Thanks! I have now implemented all your feedbacks. |
|
@dmnsgn are you planning to continue working on this? |
|
Conflicts all fixed as well. |
|
can you please squash this branch / omit the merge commit? |
Add a "table" parameter to getCoverageReport. Keep the tap coverage output intact. Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot. Group uncovered lines as ranges. Add yellow color for coverage between 50 and 90. Refs: nodejs#46674
… for truncate methods
c86191b to
98a327b
Compare
|
@MoLow done, I rebased it. |
|
Landed in 23c7f65 |
| function formatLinesToRanges(values) { | ||
| return ArrayPrototypeMap(ArrayPrototypeReduce(values, (prev, current, index, array) => { | ||
| if ((index > 0) && ((current - array[index - 1]) === 1)) { | ||
| prev[prev.length - 1][1] = current; |
| if (truncate) result = truncate(result, width); | ||
| if (color && coverage !== undefined) { | ||
| if (coverage > 90) return `${coverageColors.high}${result}${color}`; | ||
| if (coverage > 50) return `${coverageColors.medium}${result}${color}`; |
There was a problem hiding this comment.
Not sure if these values should be configurable someway...
|
I missed to publish my review before, anyway good to know this has landed :-) |
Add a "table" parameter to getCoverageReport. Keep the tap coverage output intact. Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot. Group uncovered lines as ranges. Add yellow color for coverage between 50 and 90. Refs: #46674 PR-URL: #47791 Reviewed-By: Moshe Atlow <[email protected]>
Add a "table" parameter to getCoverageReport. Keep the tap coverage output intact. Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot. Group uncovered lines as ranges. Add yellow color for coverage between 50 and 90. Refs: nodejs#46674 PR-URL: nodejs#47791 Reviewed-By: Moshe Atlow <[email protected]>
Add a "table" parameter to getCoverageReport. Keep the tap coverage output intact. Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot. Group uncovered lines as ranges. Add yellow color for coverage between 50 and 90. Refs: nodejs#46674 PR-URL: nodejs#47791 Reviewed-By: Moshe Atlow <[email protected]>
Add a "table" parameter to getCoverageReport. Keep the tap coverage output intact. Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot. Group uncovered lines as ranges. Add yellow color for coverage between 50 and 90. Refs: #46674 PR-URL: #47791 Reviewed-By: Moshe Atlow <[email protected]>
Add a "table" parameter to getCoverageReport.
Keep the tap coverage output intact.
Change the output by adding padding and truncating the tables' cells. Add separation lines for table head/body/foot.
Group uncovered lines as ranges.
Add yellow color for coverage between 50 and 90.
Refs: #46674