Registry / testing / karma-remap-coverage

karma-remap-coverage

JSON →
library0.1.5jsnpmunverified

Karma reporter that remaps Istanbul coverage reports to original source code using source maps, enabling accurate coverage for transpiled languages like TypeScript, ES6/7 with Babel, or JSX. Currently at v0.1.5, last released in 2017, with no further updates. Works in watch mode and stores interim coverage in memory (via karma-coverage's 'in-memory' type) to avoid temporary files. Integrates with webpack and other bundlers that produce source maps. Alternatives: karma-coverage-istanbul-reporter, karma-typescript's built-in coverage.

npm install karma-remap-coverage
INSTALL
IMPORT
SIG · KARMA-REMAP-COVERA
K
karma-remap-coverage
testingjavascriptv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

karma-remap-coverage plugin
plugins: ['karma-remap-coverage']
plugins: ['remap-coverage']
Plugin name in Karma config must be 'karma-remap-coverage', not the reporter name 'remap-coverage'.
remapCoverageReporter config
remapCoverageReporter: { html: './coverage' }
remapReporter: {}
The config key is 'remapCoverageReporter', not 'remapReporter' or 'coverageReporter'.
coverageReporter type
coverageReporter: { type: 'in-memory' }
coverageReporter: { type: 'html' }
Must set coverageReporter.type to 'in-memory' to pass interim report to remap reporter.

Shows minimal Karma config to enable remapped coverage: set reporters, use in-memory coverage, and configure remap output.

// Install: npm install karma-remap-coverage karma-coverage --save-dev // karma.conf.js module.exports = function(config) { config.set({ files: ['test/**/*.spec.ts'], preprocessors: { 'test/**/*.spec.ts': ['webpack', 'sourcemap', 'coverage'] }, reporters: ['progress', 'coverage', 'remap-coverage'], coverageReporter: { type: 'in-memory' }, remapCoverageReporter: { html: './coverage', 'text-summary': null }, plugins: ['karma-coverage', 'karma-remap-coverage'], webpack: { devtool: 'inline-source-map' } }); };
Debug
Known issues
deprecatedPackage is unmaintained since 2017; no TypeScript 3+ or Babel 7+ compatibility guaranteed.
fix
Migrate to karma-coverage-istanbul-reporter or use built-in coverage in karma-typescript.
affects: >=0.1.5
gotchaBoth karma-coverage and karma-remap-coverage must be included in plugins array.
fix
Add both 'karma-coverage' and 'karma-remap-coverage' to plugins list in karma.conf.js.
affects: *
gotchacoverageReporter.type must be 'in-memory', not other values like 'json', otherwise remap won't work.
fix
Set coverageReporter: { type: 'in-memory' } and do not specify any other output from karma-coverage.
affects: *
gotchaSource maps must be enabled in transpiler config (e.g., tsconfig.json sourceMap: true, webpack devtool), or remap will produce empty reports.
fix
Ensure source maps are generated for your source files and passed to Karma.
affects: *
Errors
Common errors & fixes
Error: No provider for "framework:remap-coverage"!
Karma plugin not loaded or misspelled in plugins array.
fix
Add 'karma-remap-coverage' to plugins list (note: not 'remap-coverage' without prefix).
No coverage report generated. Check that coverageReporter type is 'in-memory'.
Missing coverageReporter.type: 'in-memory' or wrong reporter name.
fix
Add coverageReporter: { type: 'in-memory' } to karma config and ensure reporters includes 'coverage' and 'remap-coverage'.
TypeError: Cannot read property 'remapCoverageReporter' of undefined
remapCoverageReporter config not defined or Karma version incompatibility.
fix
Add remapCoverageReporter object in karma config with at least one output format, e.g., remapCoverageReporter: { html: './coverage' }.
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies
karma-coveragerequiredPeer dependency: must be installed alongside to generate interim coverage reports
Agent activity
5 hits · last 30 days
node
4
Bingbot
1
Resources
karma-remap-coverage — npm install karma-remap-coverage · libregistry