deno
deno copied to clipboard
fix(coverage): Make output table markdown compatible
This changes the format of the table outputted by deno coverage to be markdown compatible.
deno bench also outputs a table to the console, and there might very well be other commands too. However, both coverage and bench has their own logic for building up and outputting the table. So there is an opportunity to create a more generic (markdown) table builder/generator. However, as I'm not too familiar with the codebase, I did not do any generalization, and tried to keep the changes as minimal as possible to produce a markdown compatible table with the existing logic.
Example of current output (without this change):
$ deno coverage
-----------------------------------
File | Branch % | Line % |
-----------------------------------
parser.ts | 87.1 | 86.4 |
tokenizer.ts | 80.0 | 92.3 |
-----------------------------------
All files | 86.1 | 87.4 |
-----------------------------------
Example of new output (with this change):
$ deno coverage
| File | Branch % | Line % |
| ------------ | -------- | ------ |
| parser.ts | 87.1 | 86.4 |
| tokenizer.ts | 80.0 | 92.3 |
| All files | 86.1 | 87.4 |
Related #29532 Closes #29465