Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Original files in HTML reporter #648
This is a first attempt to fix #614.
My idea is to adapt the HTML report to display original files when source maps is present.
Sloc number, coverage percent and "covered/not covered" counter are wrong for now, because they are computed from generated files, and not from original files.
I had to update the
Just to let you know: I've found that inlined and external source maps are not reported the same due to my latest modification.
So my TODO list is:
Supporting inline maps involved a huge refactor, but it's nearly done.
@geek while trying to figure out how to get sloc and hits in original files, I found that any lines are considered as "line of code", even comments (
Did I missed something ?
Hello @geek !
For Html reporter, I've finally decided to hide sloc counter / coverage percentage on original files, to only show them on generated files. In fact, sourcemaps allow to reverse the original file content, but can't be blindly used to recompute SLOC & coverage.
I've fixed this, to rely only on the AST output. Now SLOC is:
All this works (I've added another test), but has an unexpected impact: it mechanically lower the overall coverage percentage.
I leave you the final appreciation, I can easily revert the SLOC computation to what it was before.
@geek, nicely spotted !
It was the opportunity for me to refactor the code, and use only the AST to detect commented lines.
Can you please give a try ?