remap-istanbul
Version:
A tool for remapping Istanbul coverage via Source Maps
23 lines (17 loc) • 459 B
JavaScript
module.exports = function remapFunction(genItem, getMapping) {
const mapping = getMapping(genItem.loc);
if (!mapping) {
return null;
}
const declMapping = genItem.decl && getMapping(genItem.decl);
const srcItem = {
name: genItem.name,
line: mapping.loc.start.line,
loc: mapping.loc,
decl: declMapping ? declMapping.loc : undefined,
};
if (genItem.skip) {
srcItem.skip = genItem.skip;
}
return { srcItem, source: mapping.source };
};