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

ReferenceError: function is not defined. In Jasmine unitest

I have a function need to test. var getPrepaidFieldInfo = function (field, root) { if (field === 'PatientDOB') { return { fieldName: root.localizedStrings.patientDobLabel, …
Pham Minh Tan
  • 2,076
  • 7
  • 25
  • 37
0
votes
0 answers

Istanbul.js Fails At Cover Time With AMD Modules

I writting an app using Backbone/Marionette and RequireJS with AMD-style modules and I trying to add a coverage step to it, but, when running istanbul cover myTestFile.js, istanbul throws this…
Hugo
  • 6,244
  • 8
  • 37
  • 43
0
votes
0 answers

How to include required files in Istanbul that are not in same directory as test case?

I'm trying to do something simple, but it's not working.. I must be doing something dumb. I am using Istanbul with Mocha for code coverage + unit testing. In the code being tested, it is using functions from modules which are being require'd, and I…
Stretch
  • 3,669
  • 2
  • 28
  • 40
0
votes
2 answers

Jasmine Testing Ternary Conditionals

Assume we have the following JavaScript code. object = _.isUndefined(object) ? '' : aDifferentObject.property; How would we be able to write a test for either scenarios in Jasmine? Would it require two seperate describe's? Or would we be able to…
0
votes
1 answer

Running w/ intern-runner: nothing outputted to terminal, no code coverage data

I am launching my Intern-based tests through the intern-runner script, like this: \intern\.bin\intern-runner config=unittest/intern My unittest\intern.js configuration file contains the following: define({ reporters: [ "junit",…
sparkles
  • 33
  • 6
0
votes
1 answer

Istanbul-generated code coverage analysis for Intern tests running in browser?

I know there is an existing post asking if it's possible to generate an HTML report of code coverage analysis for tests written and run with Intern, and it's been answered: Generate HTML code coverage reports with intern However, the post doesn't…
sparkles
  • 33
  • 6
0
votes
1 answer

Can code being tested in Intern be pre-instrumented?

I'm doing browser unit testing via Intern. Because we like to write in the CommonJS format, I'm browserifying the code into a module that can then be loaded by the Dojo AMD loader. However, the code coverage reports are also reporting on the bundled…
0
votes
0 answers

Jasmine test case for private variables

I am using jasmine 2.0 for testing javascript functions. I have backbone code which is written below. events:{ "click #div1":"div1Clicked" } div1Clicked:function(){ onComplete = function(){ some functionality …
Priya
  • 1,453
  • 4
  • 29
  • 55
0
votes
2 answers

Jasmine + Istanbul coverage not working

I'm working on lite javascript framework and my coverage statements can't reach up to 10% even though I'm sure when I'm doing my specs almost all of my functions are called. If someone has an idea on what I'm doing wrong, I will be glad to hear…
ndufreche
  • 147
  • 6
0
votes
1 answer

Is it possible to change a karma coverage report title?

I'm working on an application who has two sides; a desktop and a mobile. In order to test that everything work's fine, we wrote some unit tests, and setup a karma-coverage. I already have two config file, the first one is for mobile, the second one…
Nico
  • 255
  • 2
  • 12
0
votes
0 answers

karma-coverage breaking module loading when used with requirejs and karma

When using the coverage reporter with karma and requirejs, I am running into issues with loading one of my modules. More specifically, the module being loaded in is throwing the rather cryptic error message shown below: After some digging around, I…
wvandaal
  • 4,265
  • 2
  • 16
  • 27
0
votes
1 answer

How can I instrument mocha and a code coverage tool with CoffeeScript?

Istanbul seems great - seen lots of awesomeness there. Even blanket seems pretty cool. But none seem to play nice, and if they do, I can't figure out how to get it to play with grunt and if I can, I'm left with the problem of running…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
0
votes
1 answer

Node.js wth Istanbul code coverage

I have installed node.js is there any help to work on node.js wth istanbul to do codecoverage
Govind
  • 1
0
votes
1 answer

Intern 2.0: coverage report not generated anymore on Windows (regression)

With Intern revision 1.7, I was able to run node node_modules/intern/bin/intern-client.js config=test/internNode on Windows (Git Bash) and on CentOS (within a VirtualBox VM). If at least one test was failing, the coverage report was not…
Dom Derrien
  • 462
  • 2
  • 10
0
votes
1 answer

istanbul.yml not being picked up by istanbul

I'm using istanbul.js and it says I can create a istanbul.yml to configure it, but it's not being picked up automatically. Do I need to configure somewhere that I have created it? Running istanbul like: istanbul cover --report cobertura _mocha…
polonskyg
  • 4,269
  • 9
  • 41
  • 93
1 2 3
41
42