Support statement coverage #54530
Labels
coverage
Issues and PRs related to native coverage support.
feature request
Issues that request new features to be added to Node.js.
test_runner
Issues and PRs related to the test runner subsystem.
I think the Node.js coverage reporter should include support for reporting statement coverage.
My idea is to parse the source code into an Abstract Syntax Tree (AST) using
acorn-walk
, and then use theStatement
callback to extract statements. They could then be converted toCoverageStatement
s, (similarly to how thegetLines
function works with lines toCoverageLines
).These statements could then be mapped to ranges in the same way that lines are handled in
mapRangeToLines
.I saw a (extremely complicated) way of doing this in https://github.com/cenfun/monocart-coverage-reports/, so it appears to be possible.
The text was updated successfully, but these errors were encountered: