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
9
votes
1 answer

Karma + Browserify + Jasmine + Istanbul + React coverage

I'm trying to get the coverage report for my tests but the coverage output for all files is always on a single line showing the require with the path to the file. For example... The tests however are running fine. This is a react project so I had…
a11hard
  • 1,904
  • 4
  • 19
  • 41
8
votes
4 answers

Cannot get code coverage with Cypress + Istanbul

I tried setting up code coverage in an Angular 8 project using Cypress and istanbul nyc. I managed to get the code instrumented (the global variable __coverage__ is properly set) : and the coverage file generated in .nyc_output after running…
Majid Laissi
  • 19,188
  • 19
  • 68
  • 105
8
votes
1 answer

Cypress with Istanbul is not generating code coverage reports

I have VueJS app and Cypress for testing. I need to have code coverage info. Running tests in Cypress is generating seemingly correct .nyc_output/out.json file with numbers how many times some lines were executed. How to generate correct…
Margus Pala
  • 8,433
  • 8
  • 42
  • 52
8
votes
2 answers

Get code coverage from Cypress with babel, nyc and istanbul plugin?

For a React/Redux project I use Cypress to test the UI. I need to get code coverage from thoses tests to have the details in Sonar (but that's another story). So I began reading the docs from Cypress:…
8
votes
0 answers

Can I use NYC with ESM and Mocha without the "@std/esm" library

I work at a company where @std/esm has not been approved. I have got my Mocha test working like this... // suite.js async function wire(){ await import("./Sanity.spec.mjs"); // eslint-disable-line run(); } wire(); //Sanity.spec.mjs import…
JGleason
  • 3,067
  • 6
  • 20
  • 54
8
votes
1 answer

Tests are passing, coverage is not showing

I'm trying to get nyc ava and babel to all place nice together. I was having an issue where async / await branches were showing as not covered, so this was working, I'm having trouble integrating the babel-plugin-istanbul plugin for tests. I have…
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
8
votes
1 answer

NYC/Istanbul with .vue Vue components

Does NYC/Istanbul code reporting tool ignore template and style tags within a VueJS component file (with the extension .vue). Is nyc smart enough to do that?
user2360062
  • 663
  • 2
  • 7
  • 19
8
votes
1 answer

Grunt code coverage doesn't work

I've the following grunt file which runs the mocha tests OK (I get results of the test after running grunt.js)Now I want to add a code and I use the https://github.com/taichi/grunt-istanbul module. but when I run the grunt.js nothing happen,any…
John Jerrby
  • 1,683
  • 7
  • 31
  • 68
8
votes
1 answer

Simulating stream `error` event for tests

I'm using the latest istanbul + jasmine-node to write all my test scripts. In a few places I have a Readable stream that may emit error event, and I have no idea how to simulate such event in a test environment, to provide code coverage. Can anybody…
vitaly-t
  • 24,279
  • 15
  • 116
  • 138
8
votes
1 answer

Code coverage for nightwatch.js using Istanbul

Has anyone got code coverage to work for nightwatch.js with Istanbul. Any helpful links to the configuration will be appreciated.
Vinit Asher
  • 301
  • 1
  • 3
  • 18
8
votes
2 answers

Code coverage for AngularJS html templates

We are using istanbul for code coverage in our karma tests. This works great for tracking code coverage of our unit tests in JavaScript. However, this does not track code coverage in our HTML templates. We have very little logic in our templates,…
Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
8
votes
5 answers

Excluding files from coverage when using Karma and Istanbul

I am using Karma to test my JavaScript and get coverage reports. I am using the Istanbul coverage report, which is the default. Here is my preprocessors parameter: preprocessors: { 'framework/**/*.js':'coverage', …
Joe
  • 7,922
  • 18
  • 54
  • 83
7
votes
0 answers

jest --collect-coverage marks files as 100% covered even there is no test for them

I am trying coverage feature on jest tests but output shows 100% coverage for files which are referenced by tests, but not covered at all.. mostly they are just dependencies of modules which are tested and I am far from using all exported methods…
Luckylooke
  • 4,061
  • 4
  • 36
  • 49
7
votes
1 answer

nyc (istanbul) exclude test code from coverage reports

I'm trying to add coverage report generation to a typescript library project. The layout includes these directories: project ├─ src │ ├─ lib ## project code (typescript), *.tsx │ ├─ test ## test specs (typescript), *.spec.tsx │ └─ @types…
ShadSterling
  • 1,792
  • 1
  • 21
  • 40
7
votes
0 answers

How to setup gulp-istanbul with Qunit?

I'm using Qunit framework to test a front-end Web application. I have a requirement to generate report for code coverage. For that, I'm trying to use istanbul through a gulp task. My gulpfile.js looks like: var gulp = require('gulp'), qunit =…
Mhd
  • 2,778
  • 5
  • 22
  • 59