mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(cli/coverage): invalid line id in html reporter (#23908)
This commit is contained in:
parent
c703ddd965
commit
fa5c61e441
2 changed files with 4 additions and 1 deletions
|
@ -633,7 +633,7 @@ impl HtmlCoverageReporter {
|
|||
) -> String {
|
||||
let line_num = file_text.lines().count();
|
||||
let line_count = (1..line_num + 1)
|
||||
.map(|i| format!("<a name='L{i}'></a><a href='#{i}'>{i}</a>"))
|
||||
.map(|i| format!("<a name='L{i}'></a><a href='#L{i}'>{i}</a>"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
let line_coverage = (0..line_num)
|
||||
|
|
|
@ -486,6 +486,9 @@ fn test_html_reporter() {
|
|||
assert_contains!(bar_ts_html, "<h1>Coverage report for bar.ts</h1>");
|
||||
// Check <T> in source code is escaped to <T>
|
||||
assert_contains!(bar_ts_html, "<T>");
|
||||
// Check that line anchors are correctly referenced by line number links
|
||||
assert_contains!(bar_ts_html, "<a name='L1'></a>");
|
||||
assert_contains!(bar_ts_html, "<a href='#L1'>1</a>");
|
||||
|
||||
let baz_index_html = tempdir
|
||||
.join("html")
|
||||
|
|
Loading…
Reference in a new issue