Registry / testing / isparta

isparta

JSON →
library4.1.1jsnpmunverified

A code coverage tool for ES6 using Babel, built on top of Istanbul. Latest version is 4.1.1, released to support Babel 6.x. The project is unmaintained as of 2016 and deprecated in favor of Istanbul with its own Babel support. It provides CLI and Karma integration for instrumenting ES6 code, but lacks updates and may not work with modern Babel versions. Consider using babel-plugin-istanbul or @istanbuljs/nyc-config-babel instead.

npm install isparta
INSTALL
IMPORT
SIG · ISPARTA
I
isparta
testingjavascriptv4.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Isparta
const Isparta = require('isparta');
import Isparta from 'isparta';
isparta v4.1.1 does not support ESM imports; use CommonJS require.
instrumenter
var isparta = require('isparta'); // then in karma config: instrumenters: { isparta: isparta }
import isparta from 'isparta';
Karma instrumenter expects CommonJS module export.
CLI
babel-node node_modules/.bin/isparta cover --report text node_modules/.bin/_mocha
node node_modules/.bin/isparta cover --report text -- ...
Must use babel-node to transpile before running isparta CLI.

Demonstrates installation, Babel configuration, CLI usage, and Karma integration for ES6 code coverage.

// Install dependencies npm install --save-dev isparta babel-core babel-preset-es2015 mocha // Create a .babelrc file // { "presets": ["es2015"] } // Run coverage with isparta CLI npx babel-node node_modules/isparta/bin/isparta cover --report text --report html node_modules/mocha/bin/_mocha -- --reporter dot // For Karma, add to karma.conf.js: // coverageReporter: { // instrumenters: { isparta: require('isparta') }, // instrumenter: { '**/*.js': 'isparta' } // }
isparta --version
Debug
Known issues
deprecatedisparta is no longer maintained. Use babel-plugin-istanbul or @istanbuljs/nyc-config-babel instead.
fix
Switch to nyc with babel-plugin-istanbul: npm install --save-dev nyc babel-plugin-istanbul
affects: all
breakingBabel 6 support changed in v4.0.0; requires babel-core@6 and presets.
fix
If using Babel 5, stick with isparta@3.x. For Babel 6+, use isparta@4.x with appropriate presets.
affects: >=4.0.0
gotchaCLI must be run via babel-node; otherwise it fails with SyntaxError on ES6 modules.
fix
Use npx babel-node node_modules/.bin/isparta ... or add to scripts in package.json with babel-node.
affects: all
breakingKarma integrator requires a specific fork of karma-coverage; official karma-coverage may not work.
fix
Use douglasduteil/karma-coverage#next or upgrade to nyc and karma-nyc-reporter.
affects: >=4.0.0
gotchaOptions like --include and --exclude may not work as expected due to underlying istanbul compatibility.
fix
Test thoroughly; consider using .istanbul.yml for configuration but beware of breaking changes.
affects: all
Errors
Common errors & fixes
SyntaxError: Unexpected token import
Running isparta CLI with node instead of babel-node
fix
Use babel-node node_modules/.bin/isparta cover ...
Error: Cannot find module 'babel-core'
Missing babel-core dependency
fix
Install babel-core: npm install --save-dev babel-core
TypeError: Cannot read property 'babel' of undefined
Incorrect Karma configuration; instrumenterOptions missing
fix
Check karma-coverage fork and use proper instrumenterOptions: { isparta: { babel: { presets: ['es2015'] } } }
Error: Coverage file could not be written
Incompatibility between istanbul version and isparta
fix
Use isparta@3.5.3 with istanbul@0.4.0 or check node_modules for conflicts
Upgrade
Version history
4.1.1latest on npm
Audit
Dependencies
babel-corerequiredRequired for transpilation; version compatibility is critical.
istanbulrequiredUnderlying coverage engine; isparta wraps it.
Agent activity
10 hits · last 30 days
node
8
Resources
isparta — npm install isparta · libregistry