Registry / testing / coverage-istanbul-loader

coverage-istanbul-loader

JSON →
library3.0.5jsnpmunverified

A Webpack loader that uses Istanbul to add code coverage instrumentation to JavaScript/TypeScript files. Current stable version is 3.0.5. Release cadence is low; last major update was in 2020. Key differentiators include support for modern Istanbul API (istanbul-lib-instrument) and better source map handling compared to the older istanbul-instrumenter-loader. Ships TypeScript definitions. Requires Node >=10 and Webpack 4+. Works with Karma, TypeScript, and custom options.

npm install coverage-istanbul-loader
INSTALL
IMPORT
SIG · COVERAGE-ISTANBUL-
C
coverage-istanbul-loader
testingjavascriptv3.0.5
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–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ import CoverageIstanbulLoader from '@jsdevtools/coverage-istanbul-loader'
✗ const CoverageIstanbulLoader = require('@jsdevtools/coverage-istanbul-loader')
ESM-only since v3. CommonJS require will fail.
loader function
✓ const { default: loader } = require('@jsdevtools/coverage-istanbul-loader')
✗ const loader = require('@jsdevtools/coverage-istanbul-loader')
In CommonJS, must grab .default property.
Webpack rule usage
✓ module.exports = { module: { rules: [ { test: /\.js$/, use: { loader: '@jsdevtools/coverage-istanbul-loader', options: { esModules: true } } } ] } }
✗ use: 'coverage-istanbul-loader' (without @jsdevtools scope)
Full scoped package name required.

Configures Webpack to instrument JavaScript files for code coverage using Istanbul, with modern options.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: { loader: '@jsdevtools/coverage-istanbul-loader', options: { esModules: true, produceSourceMap: true } } } ] } }; // Run webpack, output bundle will have coverage instrumentation. // Then run tests with Karma + karma-coverage-istanbul-reporter.
Debug
Known issues
breakingVersion 3.0 is ESM-only. Using require() will fail with 'require() of ES modules not supported'.
fix
Use import or dynamic import(), or downgrade to v2.x.
affects: >=3.0.0
gotchaLoader must be placed before other loaders (like babel-loader) in webpack config to instrument original source.
fix
Ensure this loader is listed last in the 'use' array (i.e., executed first).
affects: >=1.0.0
deprecatedOption 'instrumenter' is deprecated in favor of 'istanbul-lib-instrument' options.
fix
Replace 'instrumenter' with 'istanbul-lib-instrument' options (e.g., 'esModules').
affects: >=3.0.0
gotchaSource maps may not work correctly if options.produceSourceMap is not set to true.
fix
Set produceSourceMap: true in loader options.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module '@jsdevtools/coverage-istanbul-loader'
Loader not installed or typo in package name.
fix
npm install @jsdevtools/coverage-istanbul-loader --save-dev
TypeError: loader.run is not a function
Using CommonJS require() on ESM-only v3.
fix
Use dynamic import: const loader = (await import('@jsdevtools/coverage-istanbul-loader')).default;
Module build failed: Error: Cannot find module 'istanbul-lib-instrument'
Missing peer dependency.
fix
npm install istanbul-lib-instrument --save-dev
Upgrade
Version history
3.0.5latest on npm
Audit
Dependencies
webpackrequiredPeer dependency for loader usage
istanbul-lib-instrumentrequiredCore instrumentation library
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
coverage-istanbul-loader — npm install coverage-istanbul-loader · libregistry