Source maps support for Istanbul code coverage toolkit, enabling accurate coverage reporting for transpiled JavaScript code
Overall
score
98%
Build a utility that validates and processes source maps in various formats to ensure they meet the Source Map v3 specification requirements.
You need to create a source map validator that can:
The validator should check that a source map:
version property set to 3sources (array), mappings (string)sourcesContent (array), names (array), file (string)The validator should:
The validator should provide position lookup functionality with:
@generates
/**
* Validates a source map against the Source Map v3 specification.
*
* @param {Object|string} sourceMap - The source map to validate (object or JSON string)
* @returns {Object} Validation result with { valid: boolean, errors: string[] }
*/
function validateSourceMap(sourceMap) {
// IMPLEMENTATION HERE
}
/**
* Parses a source map from string or object format into a normalized object.
*
* @param {Object|string} sourceMap - The source map to parse
* @returns {Object} The parsed source map object
* @throws {Error} If the source map cannot be parsed
*/
function parseSourceMap(sourceMap) {
// IMPLEMENTATION HERE
}
/**
* Creates a source map consumer that can look up positions with different bias modes.
*
* @param {Object} sourceMap - The parsed source map object
* @returns {Object} Consumer with lookup methods
*/
function createSourceMapConsumer(sourceMap) {
// IMPLEMENTATION HERE
}
module.exports = {
validateSourceMap,
parseSourceMap,
createSourceMapConsumer,
};Provides modern source map parsing and position lookup with support for GREATEST_LOWER_BOUND and LEAST_UPPER_BOUND bias modes.
Provides source map support for code coverage, including validation and format handling capabilities.
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