mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +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!(
|
println!(
|
||||||
" {file_name} | {branch_percent} | {line_percent} |",
|
"| {file_name} | {branch_percent} | {line_percent} |",
|
||||||
file_name = file_name,
|
file_name = file_name,
|
||||||
branch_percent = branch_percent,
|
branch_percent = branch_percent,
|
||||||
line_percent = line_percent,
|
line_percent = line_percent,
|
||||||
|
@ -192,17 +192,19 @@ impl CoverageReporter for SummaryCoverageReporter {
|
||||||
.max("All files".len());
|
.max("All files".len());
|
||||||
|
|
||||||
let header =
|
let header =
|
||||||
format!("{node:node_max$} | Branch % | Line % |", node = "File");
|
format!("| {node:node_max$} | Branch % | Line % |", node = "File");
|
||||||
let separator = "-".repeat(header.len());
|
let separator = format!(
|
||||||
println!("{}", separator);
|
"| {} | {} | {} |",
|
||||||
|
"-".repeat(node_max),
|
||||||
|
"-".repeat(8),
|
||||||
|
"-".repeat(6)
|
||||||
|
);
|
||||||
println!("{}", header);
|
println!("{}", header);
|
||||||
println!("{}", separator);
|
println!("{}", separator);
|
||||||
entries.iter().for_each(|(node, stats)| {
|
entries.iter().for_each(|(node, stats)| {
|
||||||
self.print_coverage_line(node, node_max, stats);
|
self.print_coverage_line(node, node_max, stats);
|
||||||
});
|
});
|
||||||
println!("{}", separator);
|
|
||||||
self.print_coverage_line("All files", node_max, root_stats);
|
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_exit_code(0);
|
||||||
output.assert_matches_text(
|
output.assert_matches_text(
|
||||||
"----------------------------------
|
"| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| ----------- | -------- | ------ |
|
||||||
----------------------------------
|
| bar.ts | 0.0 | 57.1 |
|
||||||
bar.ts | 0.0 | 57.1 |
|
| baz/quux.ts | 0.0 | 28.6 |
|
||||||
baz/quux.ts | 0.0 | 28.6 |
|
| baz/qux.ts | 100.0 | 100.0 |
|
||||||
baz/qux.ts | 100.0 | 100.0 |
|
| foo.ts | 50.0 | 76.9 |
|
||||||
foo.ts | 50.0 | 76.9 |
|
| All files | 40.0 | 61.0 |
|
||||||
----------------------------------
|
|
||||||
All files | 40.0 | 61.0 |
|
|
||||||
----------------------------------
|
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -642,14 +639,11 @@ File | Branch % | Line % |
|
||||||
|
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_text(
|
output.assert_matches_text(
|
||||||
"---------------------------------
|
"| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| ---------- | -------- | ------ |
|
||||||
---------------------------------
|
| baz/qux.ts | 100.0 | 100.0 |
|
||||||
baz/qux.ts | 100.0 | 100.0 |
|
| foo.ts | 50.0 | 76.9 |
|
||||||
foo.ts | 50.0 | 76.9 |
|
| All files | 66.7 | 85.0 |
|
||||||
---------------------------------
|
|
||||||
All files | 66.7 | 85.0 |
|
|
||||||
---------------------------------
|
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,9 @@ file:///[WILDCARD]/source.ts$[WILDCARD].ts ... ok ([WILDCARD])
|
||||||
|
|
||||||
ok | 2 passed | 0 failed ([WILDCARD])
|
ok | 2 passed | 0 failed ([WILDCARD])
|
||||||
|
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| source.ts | 100.0 | 100.0 |
|
||||||
source.ts | 100.0 | 100.0 |
|
| All files | 100.0 | 100.0 |
|
||||||
--------------------------------
|
|
||||||
All files | 100.0 | 100.0 |
|
|
||||||
--------------------------------
|
|
||||||
Lcov coverage report has been generated at file://[WILDCARD]/coverage/lcov.info
|
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
|
HTML coverage report has been generated at file://[WILDCARD]/coverage/html/index.html
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| source.ts | 100.0 | 100.0 |
|
||||||
source.ts | 100.0 | 100.0 |
|
| All files | 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])
|
ok | 2 passed | 0 failed ([WILDCARD])
|
||||||
|
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| source.ts | 100.0 | 100.0 |
|
||||||
source.ts | 100.0 | 100.0 |
|
| All files | 100.0 | 100.0 |
|
||||||
--------------------------------
|
|
||||||
All files | 100.0 | 100.0 |
|
|
||||||
--------------------------------
|
|
||||||
Lcov coverage report has been generated at file://[WILDCARD]/coverage/lcov.info
|
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
|
HTML coverage report has been generated at file://[WILDCARD]/coverage/html/index.html
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| main.ts | 100.0 | 100.0 |
|
||||||
main.ts | 100.0 | 100.0 |
|
| All files | 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.
|
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 % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| main.ts | 0.0 | 40.0 |
|
||||||
main.ts | 0.0 | 40.0 |
|
| All files | 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.
|
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 % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| main.ts | 100.0 | 100.0 |
|
||||||
main.ts | 100.0 | 100.0 |
|
| All files | 100.0 | 100.0 |
|
||||||
--------------------------------
|
|
||||||
All files | 100.0 | 100.0 |
|
|
||||||
--------------------------------
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| source.ts | 100.0 | 100.0 |
|
||||||
source.ts | 100.0 | 100.0 |
|
| All files | 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.
|
WARNING: Unterminated deno-coverage-ignore-start comment at file:///[WILDLINE]/main.ts:2:3 will be ignored.
|
||||||
--------------------------------
|
| File | Branch % | Line % |
|
||||||
File | Branch % | Line % |
|
| --------- | -------- | ------ |
|
||||||
--------------------------------
|
| main.ts | 0.0 | 40.0 |
|
||||||
main.ts | 0.0 | 40.0 |
|
| All files | 0.0 | 40.0 |
|
||||||
--------------------------------
|
|
||||||
All files | 0.0 | 40.0 |
|
|
||||||
--------------------------------
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue