Source maps support for Istanbul code coverage toolkit, enabling accurate coverage reporting for transpiled JavaScript code
Overall
score
98%
Build a utility that maps code locations from transpiled/generated JavaScript back to their original source positions using source maps.
When debugging transpiled JavaScript code, developers need to map stack trace locations from generated code back to the original source. Your task is to build a simple utility that takes source map data and performs position mapping for code locations.
Create a Node.js module that performs source map position lookups. The module should:
The module should work with standard source map objects that contain version, sources, sourcesContent, mappings, and names fields.
@generates
/**
* Maps a position in generated code to its original source location.
*
* @param {Object} sourceMapData - Source map object with version, sources, mappings, etc.
* @param {number} line - Line number in generated code (1-based)
* @param {number} column - Column number in generated code (0-based)
* @returns {Object|null} Original position with { source, line, column } or null if no mapping
*/
function mapPosition(sourceMapData, line, column) {
// Implementation here
}
module.exports = {
mapPosition
};Provides source map support for position mapping and transformation utilities.
@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