gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

Chained executions not included in coverage #878

Open Owlbertz opened 6 years ago

Owlbertz commented 6 years ago

Hi,

I have the following code

    D3NodeHelper.prototype.generateDragConnection = function (connectionsGroup) {
        return connectionsGroup.append('line')
            .classed('drag-link', true)
            .classed('tool-connect', true)
            .attr('x1', 0)
            .attr('y1', 0)
            .attr('x2', 0)

However, only the first line return connectionsGroup.append('line') is considered as covered (indicated by the 1x) at the beginning of the line, as seen below: image

This of course reduces the overall overage of my code a lot. Is there any way to make Istanbul consider these chained executions properly?