1
0
Fork 0
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:
Simon Lecoq 2024-05-21 07:37:36 -04:00 committed by GitHub
parent c703ddd965
commit fa5c61e441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -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)

View file

@ -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 &lt;T&gt;
assert_contains!(bar_ts_html, "&lt;T&gt;");
// 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")