CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-istanbul-lib-source-maps

Source maps support for Istanbul code coverage toolkit, enabling accurate coverage reporting for transpiled JavaScript code

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-6/

Coverage Transformer with Embedded Source Map Support

A utility for transforming Istanbul coverage data that has embedded source maps, converting coverage locations from transpiled code back to original source files.

Capabilities

Transform coverage with embedded source maps

  • Given coverage data with an embedded inputSourceMap property, the transformation returns a coverage map that references the original source file path and original source locations @test
  • Given coverage data where the embedded source map has sourcesContent, the transformation caches the original source content for later retrieval @test

Handle multiple files with embedded maps

  • Given coverage data for multiple files each with their own embedded source maps, the transformation correctly maps each file to its respective original source @test

Fallback to registered maps

  • Given coverage data without an embedded inputSourceMap but with a registered source map via registerMap, the transformation uses the registered map to transform coverage @test

Implementation

@generates

API

/**
 * Creates a source map store for managing source maps and transforming coverage data.
 *
 * @param {Object} opts - Optional configuration
 * @param {string} opts.baseDir - Base directory for resolving relative paths (defaults to process.cwd())
 * @param {boolean} opts.verbose - Enable verbose logging
 * @returns {MapStore} MapStore instance
 */
function createSourceMapStore(opts) {
  // IMPLEMENTATION HERE
}

/**
 * MapStore - manages source maps and transforms coverage data
 *
 * Methods:
 * - registerMap(filePath, sourceMap): Registers a source map object for a transformed file
 * - transformCoverage(coverageMap): Asynchronously transforms coverage data using embedded or registered source maps
 *   Returns a Promise that resolves to a transformed CoverageMap with original source locations
 */

module.exports = {
  createSourceMapStore
};

Dependencies { .dependencies }

istanbul-lib-source-maps { .dependency }

Provides source map support for Istanbul code coverage transformation, including MapStore creation, source map registration, and coverage transformation capabilities.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-istanbul-lib-source-maps

tile.json