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

When use istanbul, is there any way to dynamic require config.js?

The logEnable is write in config.js, is there any way to change the value during testing? So than I can improve the branch coverage.
keenwon
  • 99
  • 1
  • 5
0
votes
1 answer

echo "some command" using bash on Windows

So I have the following sequences of commands, and I don't believe it runs on Windows, but it runs on a Mac: echo "istanbul cover /Users/Olegzandr/WebstormProjects/suman/test/build-tests/empty.test.js --dir ./coverage/empty.test istanbul cover…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
0 answers

node.js/express unit testing -- safe to ignore configuration files in Istanbul?

I'm sorry if this is a rather ambiguous question -- I used to be one of those devs who is far too lazy to write unit tests, but now that I'm working on a pretty large project, I've come to see the value in them. I've set up istanbul with some…
natnai
  • 554
  • 2
  • 10
0
votes
1 answer

Analyse code coverage of a nodejs app during a crash recover story

I am actually trying to reach the highest score of code coverage for my nodeJS app, I am using Mocha + Chai + Istanbul to ensure this code coverage. Part of my code's app is dedicated to recover a potential service interruption, to do so most of app…
Etienne Cha
  • 345
  • 3
  • 11
0
votes
1 answer

setting up istanbul on windows with jasmine 2 / finding spec\support\jasmine.json

I am reading through the documentation on karma and istanbul to set up code coverage. I am not sure what I am missing. I included everything that I have used to figure this step out so I apologize if it is long winded. I tried the to run the…
Winnemucca
  • 3,309
  • 11
  • 37
  • 66
0
votes
1 answer

Istanbul.js - remove decoration from source code

In the initial state I have e.g. app.module.js with the following code of Angular application: 'use strict'; var app = angular.module('bumblebee', []); In order to get test coverage for e2e protractor tests I apply the…
zmii
  • 4,123
  • 3
  • 40
  • 64
0
votes
1 answer

No artifacts found. CircleCI and CodeClimate integration (Node,Mocha,Istanbul)

Istanbul puts everything into coverage folder. In circle.yaml I set the below ENV var as artifact folder. CIRCLE_ARTIFACTS: ~/proj_name/coverage CircleCI doesn't seem to find artifacts. Build says no atrifacts found. Am I missing anything here?
phani
  • 1,134
  • 1
  • 11
  • 24
0
votes
1 answer

Istanbul Mocha and Sails using yeoman generator-sails-rest-api

Im attempting to make this Code Coverage functionality work from the Sails Documentation so from the project root I run istanbul cover -x "**/config/**" _mocha -- --timeout 5000 Which returns Unable to resolve file [_mocha] So thinking maybe…
maehue
  • 505
  • 10
  • 26
0
votes
1 answer

No code coverage in Babel Jest

I have a problem with code coverage. This the tests results : [...] 24 tests passed (24 total in 9 test suites, run time 2.353s) ----------|----------|----------|----------|----------|----------------| File | % Stmts | % Branch | % Funcs | %…
MathKimRobin
  • 1,268
  • 3
  • 21
  • 52
0
votes
1 answer

Error generating TypeScript code coverage reports with remap-istanbul + browserify + source maps

I'm getting the following error: Error: Could not find file: "..\..\..\..\source\node_modules\browserify\node_modules\browser-pack\_prelude.js" at readFile…
Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93
0
votes
1 answer

Test coverage of Browserify standalone (UMD) modules

I use the browserify standalone option in the following gulp tasks to generate an UMD module: gulp.task("bundle-source", function () { var b = browserify({ standalone : 'inversify', entries: __dirname + "/build/source/inversify.js", …
Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93
0
votes
1 answer

Istanbul cover throw strange error

Trying to run istanbul cover but getting the following set of errors and can't seem to fix them. This is a simple code coverage test. Actual command is: istanbul cover --dir ../artifacts --report html -- ./node_modules/mocha/bin/_mocha tests/unit/*…
Dup Step
  • 218
  • 1
  • 6
0
votes
1 answer

Node.js Code Coverage of Certain Test Files

I just came into a Node.js project that has a ton of unit tests, most of which, unfortunately, are outdated and don't run. There's no test runner or any kind of code coverage tool implemented, and it is certainly not in my scope of work to refactor…
KJ3
  • 5,168
  • 4
  • 33
  • 53
0
votes
1 answer

Karma-coverage : Object has no method isIdentifierPart

I want to use Karma for code coverage on my JQuery Mobile project and QUnit or Jasmine for tests. I have installed all the node packages I need (karma, karma-cli, karma-coverage, jasmine/qunitjs, karma-chrome-launcher) and created the following…
axvo
  • 829
  • 2
  • 12
  • 25
0
votes
1 answer

How to ignore some statements in Javascript code coverage when using lcov and istanbul?

How is it possible to make sonarqube take into account directives found in code comments? There is a page on Istanbul describing how to ignore some branches using comments like this /* istanbul ignore if */ if (hardToReproduceError)) { return…
Anthony C.
  • 21
  • 2