mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(coverage): Make output table markdown compatible (#29533)
This changes the format of the table outputted by `deno coverage` to be markdown compatible. Related #29532 Closes #29465
This commit is contained in:
parent
fd352537ce
commit
5b65313d48
10 changed files with 52 additions and 80 deletions
|
@ -161,7 +161,7 @@ impl SummaryCoverageReporter {
|
|||
};
|
||||
|
||||
println!(
|
||||
" {file_name} | {branch_percent} | {line_percent} |",
|
||||
"| {file_name} | {branch_percent} | {line_percent} |",
|
||||
file_name = file_name,
|
||||
branch_percent = branch_percent,
|
||||
line_percent = line_percent,
|
||||
|
@ -192,17 +192,19 @@ impl CoverageReporter for SummaryCoverageReporter {
|
|||
.max("All files".len());
|
||||
|
||||
let header =
|
||||
format!("{node:node_max$} | Branch % | Line % |", node = "File");
|
||||
let separator = "-".repeat(header.len());
|
||||
println!("{}", separator);
|
||||
format!("| {node:node_max$} | Branch % | Line % |", node = "File");
|
||||
let separator = format!(
|
||||
"| {} | {} | {} |",
|
||||
"-".repeat(node_max),
|
||||
"-".repeat(8),
|
||||
"-".repeat(6)
|
||||
);
|
||||
println!("{}", header);
|
||||
println!("{}", separator);
|
||||
entries.iter().for_each(|(node, stats)| {
|
||||
self.print_coverage_line(node, node_max, stats);
|
||||
});
|
||||
println!("{}", separator);
|
||||
self.print_coverage_line("All files", node_max, root_stats);
|
||||
println!("{}", separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -615,16 +615,13 @@ fn test_summary_reporter() {
|
|||
|
||||
output.assert_exit_code(0);
|
||||
output.assert_matches_text(
|
||||
"----------------------------------
|
||||
File | Branch % | Line % |
|
||||
----------------------------------
|
||||
bar.ts | 0.0 | 57.1 |
|
||||
baz/quux.ts | 0.0 | 28.6 |
|
||||
baz/qux.ts | 100.0 | 100.0 |
|
||||
foo.ts | 50.0 | 76.9 |
|
||||
----------------------------------
|
||||
All files | 40.0 | 61.0 |
|
||||
----------------------------------
|
||||
"| File | Branch % | Line % |
|
||||
| ----------- | -------- | ------ |
|
||||
| bar.ts | 0.0 | 57.1 |
|
||||
| baz/quux.ts | 0.0 | 28.6 |
|
||||
| baz/qux.ts | 100.0 | 100.0 |
|
||||
| foo.ts | 50.0 | 76.9 |
|
||||
| All files | 40.0 | 61.0 |
|
||||
",
|
||||
);
|
||||
}
|
||||
|
@ -642,14 +639,11 @@ File | Branch % | Line % |
|
|||
|
||||
output.assert_exit_code(0);
|
||||
output.assert_matches_text(
|
||||
"---------------------------------
|
||||
File | Branch % | Line % |
|
||||
---------------------------------
|
||||
baz/qux.ts | 100.0 | 100.0 |
|
||||
foo.ts | 50.0 | 76.9 |
|
||||
---------------------------------
|
||||
All files | 66.7 | 85.0 |
|
||||
---------------------------------
|
||||
"| File | Branch % | Line % |
|
||||
| ---------- | -------- | ------ |
|
||||
| baz/qux.ts | 100.0 | 100.0 |
|
||||
| foo.ts | 50.0 | 76.9 |
|
||||
| All files | 66.7 | 85.0 |
|
||||
",
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,12 +7,9 @@ file:///[WILDCARD]/source.ts$[WILDCARD].ts ... ok ([WILDCARD])
|
|||
|
||||
ok | 2 passed | 0 failed ([WILDCARD])
|
||||
|
||||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
source.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| source.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
Lcov coverage report has been generated at file://[WILDCARD]/coverage/lcov.info
|
||||
HTML coverage report has been generated at file://[WILDCARD]/coverage/html/index.html
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
source.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| source.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
|
|
|
@ -7,12 +7,9 @@ file:///[WILDCARD]/source.ts$[WILDCARD].ts ... ok ([WILDCARD])
|
|||
|
||||
ok | 2 passed | 0 failed ([WILDCARD])
|
||||
|
||||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
source.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| source.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
Lcov coverage report has been generated at file://[WILDCARD]/coverage/lcov.info
|
||||
HTML coverage report has been generated at file://[WILDCARD]/coverage/html/index.html
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
main.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| main.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
WARNING: deno-coverage-ignore-stop comment with no corresponding deno-coverage-ignore-start comment at file:///[WILDLINE]/main.ts:5:3 will be ignored.
|
||||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
main.ts | 0.0 | 40.0 |
|
||||
--------------------------------
|
||||
All files | 0.0 | 40.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| main.ts | 0.0 | 40.0 |
|
||||
| All files | 0.0 | 40.0 |
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
WARNING: Nested deno-coverage-ignore-start comment at file:///[WILDLINE]/main.ts:4:5. A previous deno-coverage-ignore-start comment at file:///[WILDLINE]/main.ts:2:3 is unterminated.
|
||||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
main.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| main.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
source.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| source.ts | 100.0 | 100.0 |
|
||||
| All files | 100.0 | 100.0 |
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
WARNING: Unterminated deno-coverage-ignore-start comment at file:///[WILDLINE]/main.ts:2:3 will be ignored.
|
||||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
main.ts | 0.0 | 40.0 |
|
||||
--------------------------------
|
||||
All files | 0.0 | 40.0 |
|
||||
--------------------------------
|
||||
| File | Branch % | Line % |
|
||||
| --------- | -------- | ------ |
|
||||
| main.ts | 0.0 | 40.0 |
|
||||
| All files | 0.0 | 40.0 |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue