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 786 forks source link

How to indicate which are the source files? #647

Closed jcubic closed 8 years ago

jcubic commented 8 years ago

I'm calling cli.js to generate the coverage using this command:

node_modules/istanbul/lib/cli.js cover node_modules/jasmine/bin/jasmine.js

it generate the coverage that look like this:

Statements   : 73.59% ( 2761/3752 )
Branches     : 56.08% ( 1089/1942 )
Functions    : 79.29% ( 448/565 )
Lines        : 73.81% ( 2759/3738 )

but my main source file that I'm testing have 5272 lines.

I've tried to put preserve-comments: true in .istanbul.yml file with no effect.

I have this in my jasmine spec file:

if (typeof window === 'undefined') {
    var node = true;
    var jsdom = require("jsdom");
    global.document = jsdom.jsdom();
    global.window = global.document.parentWindow;
    var navigator = {userAgent: "node-js", platform: "Linux i686"};
    global.window.navigator = global.navigator = navigator;
    global.jQuery = global.$ = require("jquery");
    require('../js/jquery.terminal-src');
    require('../js/unix_formatting');
    global.location = {};
}
//tests
gotwarlost commented 8 years ago

Not sure what your question is. "Line count" is the count of lines that have executable statements, ignoring comments, blank lines and JS that is not executable. It is not a physical count of the lines in your code.