Questions tagged [istanbul]

A JavaScript code coverage tool written in JavaScript.

The Istanbul 2.0 API is now available and is being actively developed in the new istanbuljs organization.

Istanbul - a JavaScript code coverage tool written in JavaScript

Features

  • All-JavaScript instrumentation library that tracks statement, branch, and function coverage.
  • Module loader hooks to instrument code on the fly
  • Command line tools to run node unit tests "with coverage turned on" and no cooperation whatsoever from the test runner
  • Multiple report formats: HTML, LCOV, Cobertura, and more.
  • Ability to use as middleware when serving JavaScript files that need to be tested on the browser.
  • Can be used on the command line as well as a library
  • Based on the awesome esprima parser and the equally awesome escodegen code generator
  • Well-tested on Node.js (prev, current and next versions) and the browser (instrumentation library only)
564 questions
139
votes
3 answers

How do I read an Istanbul Coverage Report?

I've always used Jasmine for my unit tests, but recently I started using Istanbul to give me code coverage reports. I mean I get the gist of what they are trying to tell me, but I don't really know what each of these percentages represent (Stmts,…
Scott Sword
  • 4,283
  • 5
  • 29
  • 37
63
votes
3 answers

What is a branch in code coverage for JavaScript unit testing

I use Istanbul for code coverage of unit tests in an AngularJS project. There are 4 types of coverage and they are statement branch function line Statement, function and line are alright but i don't understand what "branch" is. What is branch?
Evren Kutar
  • 953
  • 1
  • 8
  • 11
49
votes
3 answers

Running Mocha + Istanbul + Babel

I'm having some issues while running istanbul with mocha and the babel compiler.. all my tests are runnning just fine, but after all the tests done it shows me this message: No coverage information was collected, exit without writing coverage…
Weslley Araujo
  • 658
  • 1
  • 6
  • 17
44
votes
4 answers

Jest: Ignore lines for code coverage

In Jest, is there any way to ignore code for test coverage? I tried using /* istanbul ignore next */ But it doesn't seem to work.
Nahush Farkande
  • 3,756
  • 3
  • 21
  • 31
38
votes
5 answers

How do you use Istanbul Code Coverage with transpiled Typescript?

I've been reading articles on this all morning trying to get my environment setup correctly. But for some reason I'm not getting it. My setup- /app ... source (mixed js and ts) /scripts ... copied source (js) typescripts.js // transpiled…
micah
  • 6,213
  • 6
  • 35
  • 62
37
votes
1 answer

Blanket.js vs Istanbul-js vs JSCover

I am trying to decide on a JS test code coverage tool but cannot see clearly the differences between them. The top hits in Google are blanket.js, istanbul-js and JSCover. Can anyone offer any information on the key differences between them and…
Christopher Grigg
  • 1,895
  • 20
  • 28
31
votes
2 answers

angular cli exclude files/directory for `ng test --code-coverage`

I am running the following command to unit test and generate code code coverage report. ng test --code-coverage It is working fine and writing code coverage report in coverage folder. In this I got all files and directory coverage report But I…
Partha Sarathi Ghosh
  • 8,730
  • 18
  • 53
  • 79
30
votes
7 answers

Jest finds tests but doesn't collect coverage

I trying to collect test coverage for this project using yarn test --coverage # i.e. "react-scripts test --coverage" My jest config is this: "jest": { "collectCoverageFrom": [ "src/**/*.ts*" ], "coverageThreshold": { …
Lual
  • 1,776
  • 1
  • 20
  • 24
26
votes
1 answer

"E" and "I" symbols in istanbul HTML reports

what do the "I" and "E" symbols with the black backgrounds signify in the HTML reports generated by the istanbul JS code coverage tool?
almel
  • 5,614
  • 10
  • 36
  • 52
26
votes
4 answers

Excluding files from coverage when using Mocha and Istanbul

How can I exclude folders and files (by path) from coverage report when using mocha and instanbul? I want to exclude by a configuration and not /*istanbul ignore next*/ in each file. (The generated report use by Jenkins) Thanks,
Shai M.
  • 1,164
  • 3
  • 13
  • 28
25
votes
3 answers

How to get karma-coverage (istanbul) to check coverage of ALL source files?

The code structure I have an app directory structure like scripts/sequoia/ ├── GraphToolbar.js ├── nodes │   ├── activityNode.js │   └──…
23
votes
4 answers

How to make Istanbul generate coverage for all of my source code?

Currently Istanbul is only generating coverage for files that are used in my tests, which is okay, but seems to defeat the purpose of having coverage somewhat. I have no Istanbul configuration, and am invoking it via npm test with the following…
Seer
  • 5,138
  • 5
  • 31
  • 52
23
votes
1 answer

sending arguments to test script with istanbul

I'm trying to see my Mocha test code coverage with istanbul, but I need to supply the --recursive arguments to the test script _mocha, because else it only runs the tests in the test directory. I tried istanbul cover "_mocha --recursive" but it says…
Ygg
  • 3,058
  • 1
  • 14
  • 23
22
votes
1 answer

Istanbul nyc to exclude test files

I'm currently getting my test files in the final coverage. That's probably because they sit alongside my components instead of having their own test folder. How can I exclude these from the coverage? I have installed istanbul and nyc and I'm using…
Manu
  • 1,132
  • 1
  • 12
  • 21
22
votes
2 answers

How to ignore branch coverage for missing 'else'

Is it possible to ignore the marker E in istanbul branch coverage? I am using Jasmine+karma+Istanbul. Is there any possibility to ingore E and get 100% branch coverage? Maybe a property that can be set in config? Here is an example of the coverage…
rajesh madaswamy
  • 319
  • 3
  • 11
1
2 3
37 38