Registry / testing / rollup-plugin-istanbul2

rollup-plugin-istanbul2

JSON →
library2.0.2jsnpmunverified

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.

npm install rollup-plugin-istanbul2
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-ISTA
R
rollup-plugin-istanbul2
testingjavascriptv2.0.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default (istanbul)
✓ import istanbul from 'rollup-plugin-istanbul'
✗ import { istanbul } from 'rollup-plugin-istanbul'
The plugin exports a default function; named import is incorrect.
require (CJS)
✓ const istanbul = require('rollup-plugin-istanbul').default;
✗ const istanbul = require('rollup-plugin-istanbul');
In CommonJS, .default is required because the module uses ESM internally.
TypeScript usage
✓ import istanbul from 'rollup-plugin-istanbul';
TypeScript types are included; default import works with esModuleInterop.

Minimal Rollup configuration using rollup-plugin-istanbul to instrument source files, excluding test directory.

// Install: npm install --save-dev rollup rollup-plugin-istanbul // rollup.config.js import istanbul from 'rollup-plugin-istanbul'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ istanbul({ exclude: ['test/**/*.js'] }) ] };
Debug
Known issues
breakingv2.0.0: Switch from istanbul to istanbul-lib-instrument; older istanbul options no longer work.
fix
Update to >=2.0.0 and use istanbul-lib-instrument compatible options (see instrumenterConfig).
affects: <2.0.0
breakingv3.0.0: Defaults for autoWrap, preserveComments, esModules, produceSourceMap changed to true. Minimum Node.js 10 required.
fix
If you relied on old defaults, explicitly set these options to false in instrumenterConfig.
affects: <3.0.0
breakingv4.0.0: Dropped Node 10 and 12, istanbul-lib-instrument version ^5.2.1; coverage location fix may change output.
fix
Upgrade Node to >=14 and test coverage output for changes.
affects: <4.0.0
breakingv5.0.0: Dropped Node 14, Rollup v4 required, istanbul-lib-instrument ^6.0.1.
fix
Upgrade Node to >=16, Rollup to >=4, and update instrumenterConfig if needed.
affects: <5.0.0
gotchaPlugin applies to all files in include glob by default; test files must be excluded to avoid instrumenting test code.
fix
Always set 'exclude' option (e.g., exclude: ['test/**/*.js']) to prevent instrumenting test files.
affects: >=1.0.0
deprecatedThe 'compact' option in plugin options is deprecated; use instrumenterConfig.compact instead.
fix
Pass compact via instrumenterConfig: { compact: true }.
affects: >=3.0.0
Errors
Common errors & fixes
Error: 'default' is not exported by rollup-plugin-istanbul
Using named import { istanbul } instead of default import in ESM.
fix
Use: import istanbul from 'rollup-plugin-istanbul';
TypeError: istanbul is not a function
In CommonJS, require returns an object with .default property.
fix
Use: const istanbul = require('rollup-plugin-istanbul').default;
Error: Cannot find module 'istanbul-lib-instrument'
Missing dependency for istanbul-lib-instrument.
fix
Run: npm install --save-dev istanbul-lib-instrument
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
rolluprequiredpeer dependency: plugin requires Rollup >=1.17.0 (v5 requires Rollup >=4)
istanbul-lib-instrumentrequiredruntime dependency for instrumentation logic
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources