{"id":21970,"library":"rollup-plugin-coverage","title":"rollup-plugin-coverage","description":"Rollup plugin for Istanbul unit test coverage. Version 0.1.4 provides integration with Istanbul instrumenter for code coverage reporting in Rollup and Karma. It offers options for include/exclude patterns, coverage options, and sourcemap support. The plugin is no longer actively maintained; users are advised to migrate to @rollup/plugin-istanbul or official Rollup coverage plugins.","status":"deprecated","version":"0.1.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","rollup-plugin","istanbul","es2015","buble","es6","rollup","instrumenter","coverage"],"install":[{"cmd":"npm install rollup-plugin-coverage","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-coverage","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-coverage","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Rollup bundler API","package":"rollup","optional":false},{"reason":"Coverage engine used internally","package":"istanbul","optional":false}],"imports":[{"note":"ESM default import; CJS require works but is not idiomatic for Rollup configs","wrong":"const coverage = require('rollup-plugin-coverage')","symbol":"default","correct":"import coverage from 'rollup-plugin-coverage'"},{"note":"Package exports a default export only, not named.","wrong":"import { coverage } from 'rollup-plugin-coverage'","symbol":"coverage","correct":"import coverage from 'rollup-plugin-coverage'"},{"note":"CommonJS requires .default access due to ESM default export","wrong":"const coverage = require('rollup-plugin-coverage')","symbol":"coverage","correct":"const coverage = require('rollup-plugin-coverage').default"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport coverage from 'rollup-plugin-coverage';\n\nrollup({\n  input: 'src/main.js',\n  plugins: [\n    coverage({\n      exclude: ['test/**/*.js', 'node_modules/**'],\n      coverageOptions: {\n        esModules: true\n      }\n    })\n  ]\n}).then(bundle => bundle.write({ file: 'dist/bundle.js', format: 'es' }));","lang":"javascript","description":"Configures Rollup with Istanbul coverage, excluding test files and setting ES module instrumentation."},"warnings":[{"fix":"Replace with @rollup/plugin-istanbul: npm install @rollup/plugin-istanbul and update import.","message":"Package has not been updated since 2018 and is effectively deprecated. Use @rollup/plugin-istanbul instead.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Place coverage plugin first in the plugins array.","message":"Plugin must be placed before other plugins (like babel) to avoid instrumentation issues.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use Karma with karma-coverage for automatic browser coverage collection.","message":"Coverage variable is not automatically captured in browser testing; requires manual extraction.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add coverageOptions: { sourceMapWithCode: true }.","message":"Sourcemap support requires setting sourceMapWithCode: true in coverageOptions.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install rollup-plugin-coverage --save-dev","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'rollup-plugin-coverage'"},{"fix":"Change import { coverage } to import coverage","cause":"Using named import instead of default import.","error":"TypeError: coverage is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}