{"id":19421,"library":"coverage-istanbul-loader","title":"coverage-istanbul-loader","description":"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.","status":"active","version":"3.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/JS-DevTools/coverage-istanbul-loader","tags":["javascript","webpack-loader","webpack","loader","istanbul","coverage","code coverage","instrumentation","instrumenter","typescript"],"install":[{"cmd":"npm install coverage-istanbul-loader","lang":"bash","label":"npm"},{"cmd":"yarn add coverage-istanbul-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add coverage-istanbul-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for loader usage","package":"webpack","optional":false},{"reason":"Core instrumentation library","package":"istanbul-lib-instrument","optional":false}],"imports":[{"note":"ESM-only since v3. CommonJS require will fail.","wrong":"const CoverageIstanbulLoader = require('@jsdevtools/coverage-istanbul-loader')","symbol":"default","correct":"import CoverageIstanbulLoader from '@jsdevtools/coverage-istanbul-loader'"},{"note":"In CommonJS, must grab .default property.","wrong":"const loader = require('@jsdevtools/coverage-istanbul-loader')","symbol":"loader function","correct":"const { default: loader } = require('@jsdevtools/coverage-istanbul-loader')"},{"note":"Full scoped package name required.","wrong":"use: 'coverage-istanbul-loader' (without @jsdevtools scope)","symbol":"Webpack rule usage","correct":"module.exports = { module: { rules: [ { test: /\\.js$/, use: { loader: '@jsdevtools/coverage-istanbul-loader', options: { esModules: true } } } ] } }"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        use: {\n          loader: '@jsdevtools/coverage-istanbul-loader',\n          options: {\n            esModules: true,\n            produceSourceMap: true\n          }\n        }\n      }\n    ]\n  }\n};\n// Run webpack, output bundle will have coverage instrumentation.\n// Then run tests with Karma + karma-coverage-istanbul-reporter.","lang":"javascript","description":"Configures Webpack to instrument JavaScript files for code coverage using Istanbul, with modern options."},"warnings":[{"fix":"Use import or dynamic import(), or downgrade to v2.x.","message":"Version 3.0 is ESM-only. Using require() will fail with 'require() of ES modules not supported'.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Ensure this loader is listed last in the 'use' array (i.e., executed first).","message":"Loader must be placed before other loaders (like babel-loader) in webpack config to instrument original source.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace 'instrumenter' with 'istanbul-lib-instrument' options (e.g., 'esModules').","message":"Option 'instrumenter' is deprecated in favor of 'istanbul-lib-instrument' options.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Set produceSourceMap: true in loader options.","message":"Source maps may not work correctly if options.produceSourceMap is not set to true.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'10':64 '2020':33 '3.0.5':23 '4':67 'add':12 'api':41 'better':47 'cadenc':25 'code':13,83 'compar':51 'coverag':2,14,82,84 'coverage-istanbul-load':1 'current':19 'custom':73 'definit':61 'differenti':35 'file':18 'handl':50 'includ':36 'instrument':15,45,57,85,86 'istanbul':3,10,40,43,56,81 'istanbul-instrumenter-load':55 'istanbul-lib-instru':42 'javascript':75 'javascript/typescript':17 'karma':70 'key':34 'last':28 'lib':44 'loader':4,7,58,78,80 'low':27 'major':29 'map':49 'modern':39 'node':63 'older':54 'option':74 'releas':24 'requir':62 'ship':59 'sourc':48 'stabl':20 'support':37 'typescript':60,71,87 'updat':30 'use':9 'version':21 'webpack':6,66,77,79 'webpack-load':76 'work':68","created_at":"2026-04-25T11:17:43.116356+00:00","updated_at":"2026-04-25T11:17:43.116356+00:00","problems":[{"fix":"npm install @jsdevtools/coverage-istanbul-loader --save-dev","cause":"Loader not installed or typo in package name.","error":"Error: Cannot find module '@jsdevtools/coverage-istanbul-loader'"},{"fix":"Use dynamic import: const loader = (await import('@jsdevtools/coverage-istanbul-loader')).default;","cause":"Using CommonJS require() on ESM-only v3.","error":"TypeError: loader.run is not a function"},{"fix":"npm install istanbul-lib-instrument --save-dev","cause":"Missing peer dependency.","error":"Module build failed: 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":"https://jstools.dev/coverage-istanbul-loader","github":"https://github.com/JS-DevTools/coverage-istanbul-loader","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/coverage-istanbul-loader","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}