Istanbul: What's the difference between statements and lines?

Created on 4 Jun 2016  路  3Comments  路  Source: gotwarlost/istanbul

Please let me know if there is a more appropriate place to ask this.

Most other coverage tools I've used before have either had statements or lines, never both leading me to think that they were one and the same. Istanbul however has both statements and lines. Can anyone clarify the difference between the two for me?

Most helpful comment

if you have a line of code that says var x= 10; console.log(x) that's one line and 2 statements.

Of the two statement coverage is more accurate - however line coverage exists for interop with line oriented coverage tools like lcov and backwards compatibility with YUI coverage (for when istanbul was written, no longer relevant now)

All 3 comments

if you have a line of code that says var x= 10; console.log(x) that's one line and 2 statements.

Of the two statement coverage is more accurate - however line coverage exists for interop with line oriented coverage tools like lcov and backwards compatibility with YUI coverage (for when istanbul was written, no longer relevant now)

if you have a line of code that says var x= 10; console.log(x) that's one line and 2 statements.

Of the two statement coverage is more accurate - however line coverage exists for interop with line oriented coverage tools like lcov and backwards compatibility with YUI coverage (for when istanbul was written, no longer relevant now)

I'm using solidity-coverage, that uses Istanbul. In many cases I've got more lines than statements. How is that possible?

@fabianorodrigo like this return ; console.log('never run');, 2 statements in one line. while the second statement will never run.

Was this page helpful?
0 / 5 - 0 ratings