Questions tagged [isparta]

Isparta is a npm package which acts as a code coverage tool for ES6 using babel.

Definition:

According to the Official Documentation:

Isparta is a code coverage tool for ES6 using babel.

Its intention is to be used with karma and karma-coverage, which provides code coverage reports using istanbul.

In other words, Isparta is a npm package which acts as a code coverage tool for ES6.

Installation:

npm install --save-dev isparta

Example Usage:

The following command would allow you to run a coverage over mocha tests:

babel-node node_modules/isparta/bin/isparta cover --report text --report html node_modules/mocha/bin/_mocha -- --reporter dot

Important Links:

Related Tags:

48 questions
17
votes
3 answers

Vue Unit Test Error: vuex requires a Promise polyfill in this browser

I created a project using vue-cli and added vuex and vue-router in it. I am trying to setup a unit test for it, but I am getting following error. Without Vuex, it used to work. PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR Error: [vuex] vuex requires a…
Saurabh
  • 71,488
  • 40
  • 181
  • 244
13
votes
4 answers

Error: Bootstrap's JavaScript requires jQuery, using Webpack

I'm new to webpack, but I started using it in one of my projects to learn about it. I would like to use jQuery with Bootstrap, however, when I launch the app, I'm getting the following error: bootstrap.min.js?5802:6Uncaught Error: Bootstrap's…
fgonzalez
  • 3,787
  • 7
  • 45
  • 79
8
votes
3 answers

How to get Browserify, Babel, and Coverage working together in Karma?

I'm growing weary of trying to get node libraries to work properly together, but it's part of the job, so here goes. I have an ES6 application intended for a browser. I have a set of unit tests for my files that I'm bringing up from when my…
jchitel
  • 2,999
  • 4
  • 36
  • 49
6
votes
2 answers

Karma-Coverage Report Shows Code As Covered (which is obviously not covered)

I a trying to generate an HTML coverage report, but it does not contain the output I expect. Maybe I'm wrong here, but it should show only those lines and methods covered which are called from the spec file, right? Somehow it does not. Update: I…
gearsdigital
  • 13,915
  • 6
  • 44
  • 73
5
votes
0 answers

Why Is Code Coverage Not Working using Istanbul?

I am trying to run code coverage for my Node project, but for some reason it's not working. I am using chai+mocha+istanbul and have also tried with nyc. My code has both ES5 as well as ES6 components, and I am using compiler tags for this. The tests…
Why
  • 626
  • 11
  • 29
5
votes
2 answers

How to Prevent Webpack Error after npm Install?

I was working on a project, and everything was going good, until I did npm install. Then, Webpack throws the following error: new ForkCheckerPlugin(), ^ TypeError: ForkCheckerPlugin is not a constructor at makeWebpackConfig…
nash
  • 523
  • 1
  • 5
  • 18
4
votes
1 answer

How do I exclude third party imports like jquery from code coverage in karma using isparta?

I'm using karma, webpack, and jasmine to test my ES6 code, with istanbul and isparta for code coverage. My tests all seem to pass, but the coverage is really low because I had to import jquery and jquery-resizable-dom, which gets included in the…
4
votes
0 answers

fetch-mock Response Does Not Have JSON Method

I'm trying to get fetch-mock to work in my testing setup, but the response object looks different than expected. Specifically, it does not have a json method. Here's the class I'm calling with the actual call to fetch: import 'whatwg-fetch'; export…
cgat
  • 3,689
  • 4
  • 24
  • 38
4
votes
0 answers

I'm trying to use Karma + Mocha for the first time

I'm trying to use Karma + Mocha for the first time. The main condition is to run the unit tests in a Docker container without any GUI. I don't have any browser, and my only choice is to use PhantomJS. I have configured all necessary plugins, configs…
A.Yamp
  • 84
  • 6
4
votes
1 answer

ENFILE: File Table Overflow with Karma

I am getting a file table overflow issue while running the Karma tests, and I have no clue how to debug this. karma.conf.js: module.exports = function (config) { config.set({ frameworks: ['jspm', 'jasmine'], files: [ …
Liam
  • 2,837
  • 23
  • 36
4
votes
2 answers

Sourcemap + istanbul/isparta code coverage for a webpack + babel (for es6) + mocha (+karma)

I have a test project at https://github.com/danielbush/webpack-babel-karma-sourcemap-coverage. It consists of two simple source files in src/, one with a deliberate error (src/lib2.js). I want to webpack and transpile using babel from ES6 to ES5 and…
Daniel Bush
  • 61
  • 1
  • 6
4
votes
1 answer

How to get code coverage numbers accurate with isparta, webpack, jasmine and karma?

I am having difficulty getting the correct code coverage numbers when trying to use a combination of webpack, isparta, jasmine and karma. The numbers at the end of a test run do not reflect the ES6 code correctly. However, the UI shows the correct…
4
votes
2 answers

Karma Coverage and Babel+Browserify Preprocessing

I'm using Karma to test my ES6 code. When I add karma-coverage to the mix, I need to add all the source files for the coverage tool to make a useful report, but when I do that, Karma gives me this error in all browsers: PhantomJS 1.9.8 (Mac OS X…
Roc
  • 2,500
  • 2
  • 15
  • 18
3
votes
0 answers

Cannot Find Children When Using Enzyme JS Mount

My expectation is that when I use Enzyme's mount function, I should be able to not only query for nodes in the top level element, but also nodes/elements that are rendered in child components. Here are the tests exhibited in the matter: import React…
cgat
  • 3,689
  • 4
  • 24
  • 38
3
votes
1 answer

Grunt, Istanbul, Isparta and TypeScript

TL;DR Has anyone used Grunt and Jasmine to successfully generate coverage reports? Long Story: I have a few tests, written in Jasmine, for which I wanted to generate some coverage information. For being generic, I have actually used grunt-istanbul,…
Xabre
  • 1,292
  • 1
  • 11
  • 17
1
2 3 4