Updating NPM dependencies
This commit is contained in:
41
node_modules/istanbul-lib-source-maps/lib/transformer.js
generated
vendored
41
node_modules/istanbul-lib-source-maps/lib/transformer.js
generated
vendored
@@ -19,8 +19,7 @@ class SourceMapTransformer {
|
||||
processFile(fc, sourceMap, coverageMapper) {
|
||||
let changes = 0;
|
||||
|
||||
Object.keys(fc.statementMap).forEach(s => {
|
||||
const loc = fc.statementMap[s];
|
||||
Object.entries(fc.statementMap).forEach(([s, loc]) => {
|
||||
const hits = fc.s[s];
|
||||
const mapping = getMapping(sourceMap, loc, fc.path);
|
||||
|
||||
@@ -31,8 +30,7 @@ class SourceMapTransformer {
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(fc.fnMap).forEach(f => {
|
||||
const fnMeta = fc.fnMap[f];
|
||||
Object.entries(fc.fnMap).forEach(([f, fnMeta]) => {
|
||||
const hits = fc.f[f];
|
||||
const mapping = getMapping(sourceMap, fnMeta.decl, fc.path);
|
||||
const spanMapping = getMapping(sourceMap, fnMeta.loc, fc.path);
|
||||
@@ -53,8 +51,7 @@ class SourceMapTransformer {
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(fc.branchMap).forEach(b => {
|
||||
const branchMeta = fc.branchMap[b];
|
||||
Object.entries(fc.branchMap).forEach(([b, branchMeta]) => {
|
||||
const hits = fc.b[b];
|
||||
const locs = [];
|
||||
const mappedHits = [];
|
||||
@@ -92,7 +89,7 @@ class SourceMapTransformer {
|
||||
return changes > 0;
|
||||
}
|
||||
|
||||
transform(coverageMap) {
|
||||
async transform(coverageMap) {
|
||||
const uniqueFiles = {};
|
||||
const getMappedCoverage = file => {
|
||||
const key = getUniqueKey(file);
|
||||
@@ -106,29 +103,31 @@ class SourceMapTransformer {
|
||||
return uniqueFiles[key].mappedCoverage;
|
||||
};
|
||||
|
||||
coverageMap.files().forEach(file => {
|
||||
for (const file of coverageMap.files()) {
|
||||
const fc = coverageMap.fileCoverageFor(file);
|
||||
const sourceMap = this.finder(file);
|
||||
if (!sourceMap) {
|
||||
const sourceMap = await this.finder(file, fc);
|
||||
|
||||
if (sourceMap) {
|
||||
const changed = this.processFile(
|
||||
fc,
|
||||
sourceMap,
|
||||
getMappedCoverage
|
||||
);
|
||||
if (!changed) {
|
||||
debug(`File [${file}] ignored, nothing could be mapped`);
|
||||
}
|
||||
} else {
|
||||
uniqueFiles[getUniqueKey(file)] = {
|
||||
file,
|
||||
mappedCoverage: fc
|
||||
mappedCoverage: new MappedCoverage(fc)
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
const changed = this.processFile(fc, sourceMap, getMappedCoverage);
|
||||
if (!changed) {
|
||||
debug(`File [${file}] ignored, nothing could be mapped`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return libCoverage.createCoverageMap(getOutput(uniqueFiles));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
create(finder, opts) {
|
||||
return new SourceMapTransformer(finder, opts);
|
||||
}
|
||||
SourceMapTransformer
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user