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)
624 questions
163
votes
4 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,648
  • 6
  • 32
  • 37
86
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
  • 1,173
  • 1
  • 9
  • 12
74
votes
6 answers

How to ignore lines for code coverage in Jest

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
  • 5,290
  • 3
  • 25
  • 35
59
votes
17 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
  • 2,848
  • 1
  • 20
  • 27
50
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
  • 10,936
  • 20
  • 59
  • 84
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 running just fine, but after all the tests done it shows me this message: No coverage information was collected, exit without writing coverage…
Weslley Araujo
  • 668
  • 1
  • 6
  • 18
39
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
  • 7,596
  • 10
  • 49
  • 90
37
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,632
  • 3
  • 17
  • 23
36
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
  • 2,238
  • 27
  • 33
33
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
  • 7,178
  • 13
  • 45
  • 58
27
votes
2 answers

Grouping istanbul code coverage report by folder

I'm running a code coverage report for NodeJs using istanbul and the nyc command. I'm using mocha for my unit tests I get a report for each file just as expected, but what I'd like to see is a report that has a single directory summary. Let me…
Ray Perea
  • 5,640
  • 1
  • 35
  • 38
26
votes
3 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
  • 359
  • 1
  • 4
  • 11
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,284
  • 4
  • 17
  • 30
26
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 │   └──…
25
votes
4 answers

Jest: How to merge coverage reports from different jest test runs

Has anyone managed to combine test coverage report from two separate jest test runs? I am newbie trying to use the default jest coverage reporters: ["json", "lcov", "text", "clover"] I have tried using nyc to combine coverage-final*.json files from…
anon_dcs3spp
  • 2,342
  • 2
  • 28
  • 62
1
2 3
41 42