{"id":22092,"library":"rollup-plugin-istanbul2","title":"rollup-plugin-istanbul","description":"Rollup plugin for seamless integration with Istanbul code coverage instrumentation. Current stable version is 5.0.0, released with support for Rollup v4 and Node.js 16+. It instruments source files before bundling, ensuring test code is not covered. Key differentiators: works as a Rollup plugin, supports source maps, configurable instrumenter options, and minimal setup. Published under MIT license, maintained by artberri. Released at a moderate cadence with 5 major versions.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/artberri/rollup-plugin-istanbul","tags":["javascript","rollup-plugin","istanbul","es2015","es6","rollup","coverage"],"install":[{"cmd":"npm install rollup-plugin-istanbul2","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-istanbul2","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-istanbul2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin requires Rollup >=1.17.0 (v5 requires Rollup >=4)","package":"rollup","optional":false},{"reason":"runtime dependency for instrumentation logic","package":"istanbul-lib-instrument","optional":false}],"imports":[{"note":"The plugin exports a default function; named import is incorrect.","wrong":"import { istanbul } from 'rollup-plugin-istanbul'","symbol":"default (istanbul)","correct":"import istanbul from 'rollup-plugin-istanbul'"},{"note":"In CommonJS, .default is required because the module uses ESM internally.","wrong":"const istanbul = require('rollup-plugin-istanbul');","symbol":"require (CJS)","correct":"const istanbul = require('rollup-plugin-istanbul').default;"},{"note":"TypeScript types are included; default import works with esModuleInterop.","wrong":"","symbol":"TypeScript usage","correct":"import istanbul from 'rollup-plugin-istanbul';"}],"quickstart":{"code":"// Install: npm install --save-dev rollup rollup-plugin-istanbul\n// rollup.config.js\nimport istanbul from 'rollup-plugin-istanbul';\n\nexport default {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js', format: 'iife' },\n  plugins: [\n    istanbul({\n      exclude: ['test/**/*.js']\n    })\n  ]\n};\n","lang":"javascript","description":"Minimal Rollup configuration using rollup-plugin-istanbul to instrument source files, excluding test directory."},"warnings":[{"fix":"Update to >=2.0.0 and use istanbul-lib-instrument compatible options (see instrumenterConfig).","message":"v2.0.0: Switch from istanbul to istanbul-lib-instrument; older istanbul options no longer work.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"If you relied on old defaults, explicitly set these options to false in instrumenterConfig.","message":"v3.0.0: Defaults for autoWrap, preserveComments, esModules, produceSourceMap changed to true. Minimum Node.js 10 required.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Upgrade Node to >=14 and test coverage output for changes.","message":"v4.0.0: Dropped Node 10 and 12, istanbul-lib-instrument version ^5.2.1; coverage location fix may change output.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Upgrade Node to >=16, Rollup to >=4, and update instrumenterConfig if needed.","message":"v5.0.0: Dropped Node 14, Rollup v4 required, istanbul-lib-instrument ^6.0.1.","severity":"breaking","affected_versions":"<5.0.0"},{"fix":"Always set 'exclude' option (e.g., exclude: ['test/**/*.js']) to prevent instrumenting test files.","message":"Plugin applies to all files in include glob by default; test files must be excluded to avoid instrumenting test code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass compact via instrumenterConfig: { compact: true }.","message":"The 'compact' option in plugin options is deprecated; use instrumenterConfig.compact instead.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'16':28 '5':70 '5.0.0':19 'artberri':63 'bundl':34 'cadenc':68 'code':12,37 'configur':51 'cover':40 'coverag':13,81 'current':15 'differenti':42 'ensur':35 'es2015':78 'es6':79 'file':32 'instrument':14,30,52 'integr':9 'istanbul':4,11,77 'javascript':73 'key':41 'licens':60 'maintain':61 'major':71 'map':50 'minim':55 'mit':59 'moder':67 'node.js':27 'option':53 'plugin':3,6,47,76 'publish':57 'releas':20,64 'rollup':2,5,24,46,75,80 'rollup-plugin':74 'rollup-plugin-istanbul':1 'seamless':8 'setup':56 'sourc':31,49 'stabl':16 'support':22,48 'test':36 'v4':25 'version':17,72 'work':43","created_at":"2026-04-27T17:03:20.612937+00:00","updated_at":"2026-04-27T17:03:20.612937+00:00","problems":[{"fix":"Use: import istanbul from 'rollup-plugin-istanbul';","cause":"Using named import { istanbul } instead of default import in ESM.","error":"Error: 'default' is not exported by rollup-plugin-istanbul"},{"fix":"Use: const istanbul = require('rollup-plugin-istanbul').default;","cause":"In CommonJS, require returns an object with .default property.","error":"TypeError: istanbul is not a function"},{"fix":"Run: npm install --save-dev istanbul-lib-instrument","cause":"Missing dependency for istanbul-lib-instrument.","error":"Error: Cannot find module 'istanbul-lib-instrument'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/artberri/rollup-plugin-istanbul","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-istanbul2","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}