{"id":20146,"library":"isparta","title":"isparta","description":"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.","status":"deprecated","version":"4.1.1","language":"javascript","source_language":"en","source_url":"git://github.com/douglasduteil/isparta","tags":["javascript","karma","karma-coverage","karma-traceur-preprocessor","istanbul","6to5","babel","es6","harmony"],"install":[{"cmd":"npm install isparta","lang":"bash","label":"npm"},{"cmd":"yarn add isparta","lang":"bash","label":"yarn"},{"cmd":"pnpm add isparta","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for transpilation; version compatibility is critical.","package":"babel-core","optional":false},{"reason":"Underlying coverage engine; isparta wraps it.","package":"istanbul","optional":false}],"imports":[{"note":"isparta v4.1.1 does not support ESM imports; use CommonJS require.","wrong":"import Isparta from 'isparta';","symbol":"Isparta","correct":"const Isparta = require('isparta');"},{"note":"Karma instrumenter expects CommonJS module export.","wrong":"import isparta from 'isparta';","symbol":"instrumenter","correct":"var isparta = require('isparta');\n// then in karma config: instrumenters: { isparta: isparta }"},{"note":"Must use babel-node to transpile before running isparta CLI.","wrong":"node node_modules/.bin/isparta cover --report text -- ...","symbol":"CLI","correct":"babel-node node_modules/.bin/isparta cover --report text node_modules/.bin/_mocha"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev isparta babel-core babel-preset-es2015 mocha\n\n// Create a .babelrc file\n// { \"presets\": [\"es2015\"] }\n\n// Run coverage with isparta CLI\nnpx babel-node node_modules/isparta/bin/isparta cover --report text --report html node_modules/mocha/bin/_mocha -- --reporter dot\n\n// For Karma, add to karma.conf.js:\n// coverageReporter: {\n//   instrumenters: { isparta: require('isparta') },\n//   instrumenter: { '**/*.js': 'isparta' }\n// }","lang":"javascript","description":"Demonstrates installation, Babel configuration, CLI usage, and Karma integration for ES6 code coverage."},"warnings":[{"fix":"Switch to nyc with babel-plugin-istanbul: npm install --save-dev nyc babel-plugin-istanbul","message":"isparta is no longer maintained. Use babel-plugin-istanbul or @istanbuljs/nyc-config-babel instead.","severity":"deprecated","affected_versions":"all"},{"fix":"If using Babel 5, stick with isparta@3.x. For Babel 6+, use isparta@4.x with appropriate presets.","message":"Babel 6 support changed in v4.0.0; requires babel-core@6 and presets.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use npx babel-node node_modules/.bin/isparta ... or add to scripts in package.json with babel-node.","message":"CLI must be run via babel-node; otherwise it fails with SyntaxError on ES6 modules.","severity":"gotcha","affected_versions":"all"},{"fix":"Use douglasduteil/karma-coverage#next or upgrade to nyc and karma-nyc-reporter.","message":"Karma integrator requires a specific fork of karma-coverage; official karma-coverage may not work.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Test thoroughly; consider using .istanbul.yml for configuration but beware of breaking changes.","message":"Options like --include and --exclude may not work as expected due to underlying istanbul compatibility.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use babel-node node_modules/.bin/isparta cover ...","cause":"Running isparta CLI with node instead of babel-node","error":"SyntaxError: Unexpected token import"},{"fix":"Install babel-core: npm install --save-dev babel-core","cause":"Missing babel-core dependency","error":"Error: Cannot find module 'babel-core'"},{"fix":"Check karma-coverage fork and use proper instrumenterOptions: { isparta: { babel: { presets: ['es2015'] } } }","cause":"Incorrect Karma configuration; instrumenterOptions missing","error":"TypeError: Cannot read property 'babel' of undefined"},{"fix":"Use isparta@3.5.3 with istanbul@0.4.0 or check node_modules for conflicts","cause":"Incompatibility between istanbul version and isparta","error":"Error: Coverage file could not be written"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}