Source maps support for Istanbul code coverage toolkit, enabling accurate coverage reporting for transpiled JavaScript code
Overall
score
98%
Build a utility that enriches Istanbul coverage data with source map information before transformation.
You need to implement a tool that:
.map files)The tool should handle:
.map file is foundCoverage data follows Istanbul's format with file paths as keys and coverage objects as values:
{
"/path/to/compiled.js": {
path: "/path/to/compiled.js",
statementMap: { ... },
fnMap: { ... },
branchMap: { ... },
s: { ... },
f: { ... },
b: { ... }
}
}The same coverage data structure, but with inputSourceMap properties added where source maps were found.
.map files in the source maps directory, the tool correctly adds source maps to those two entries and leaves the third unchanged. @test@generates
/**
* Enriches coverage data with source map information.
*
* @param {Object} coverageData - Istanbul coverage data object with file paths as keys
* @param {string} sourceMapsDir - Directory path containing .map files
* @returns {Object} The enriched coverage data with inputSourceMap properties added
*/
function enrichCoverageWithSourceMaps(coverageData, sourceMapsDir) {
// Implementation here
}
module.exports = { enrichCoverageWithSourceMaps };Provides source map storage and registration capabilities for Istanbul coverage data.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-istanbul-lib-source-mapsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10