Hacker News new | past | comments | ask | show | jobs | submit login

That is why I'd rather focus on a tool that would show lack of coverage and certainly would not even say percents of coverage, as it tricks people into getting that number to 100% and stop at that



a tool that would show lack of coverage

Except, as pointed out, there is no lack of coverage in my example. All lines are 'covered', and no line is left unexecuted. So by definition, there is no 'lack of coverage' from the perspective of lines. The key is to not think about 'coverage' as a metric on lines, and instead think of 'coverage' as a metric on program states. However, that's generally not what people think of when 'code coverage' is mentioned unless something specific like 'program space coverage' or 'code state coverage'.

Keep in mind that this can be really hard though since even very simple code can have a large state space.

Also, if you have a favorite tool that does program space coverage for node.js projects, it might be helpful to mention it here so that others can benefit. Most of the tools for node that I know are only line coverage.


I wasn't disagreeing!

My reasoning is as follows. Since evaluating coverage in terms of the state space of the program is hard, and no tools that I am aware of is actually calculating that coverage, tools that display coverage in terms of number of lines should not mislead by showing a percentage, and only focus on showing places with no coverage at all.

While in technical terms it seems like the same metric, I think it would encourage its users not to celebrate an arbitrary cap of 100% coverage, and be aware of what the tools can and cannot do.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: