-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
See
css-code-coverage/src/index.ts
Line 123 in 4443395
| // TODO: { is_covered: boolean, start_offset: number, start_line: number, end_offset: number, end_line: number }[] |
This is useful because in projectwallace.com I'm manually calculating these things myself.
// Split coverage line numbers into chunks so we can easily loop over them in our layout
let line_number_chunks = $derived.by(() => {
if (!show_coverage) return
let chunks = [
{
start_line: 0,
is_covered: line_coverage[0] === 1,
end_line: 0,
size: 0
}
]
for (let index = 0; index < line_coverage.length; index++) {
let is_covered = line_coverage[index]
if (index > 0 && is_covered !== line_coverage[index - 1]) {
let last_chunk = chunks.at(-1)!
last_chunk.end_line = index
last_chunk.size = index - last_chunk.start_line
chunks.push({
start_line: index,
is_covered: is_covered === 1,
end_line: index,
size: 0
})
}
}
let last_chunk = chunks.at(-1)!
last_chunk.size = line_coverage.length - last_chunk.start_line
return chunks
})Metadata
Metadata
Assignees
Labels
No labels