Introduce redundant vars
This commit is contained in:
parent
f590aa11f7
commit
ee31d5e24d
@ -41,7 +41,8 @@ function getSingleFileCoverageForTrace(
|
|||||||
sourceRanges = _.uniqBy(sourceRanges, s => JSON.stringify(s)); // We don't care if one PC was covered multiple times within a single transaction
|
sourceRanges = _.uniqBy(sourceRanges, s => JSON.stringify(s)); // We don't care if one PC was covered multiple times within a single transaction
|
||||||
sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === fileName);
|
sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === fileName);
|
||||||
const branchCoverage: BranchCoverage = {};
|
const branchCoverage: BranchCoverage = {};
|
||||||
for (const branchId of _.keys(coverageEntriesDescription.branchMap)) {
|
const branchIds = _.keys(coverageEntriesDescription.branchMap);
|
||||||
|
for (const branchId of branchIds) {
|
||||||
const branchDescription = coverageEntriesDescription.branchMap[branchId];
|
const branchDescription = coverageEntriesDescription.branchMap[branchId];
|
||||||
const isCovered = _.map(branchDescription.locations, location =>
|
const isCovered = _.map(branchDescription.locations, location =>
|
||||||
_.some(sourceRanges, range => utils.isRangeInside(range.location, location)),
|
_.some(sourceRanges, range => utils.isRangeInside(range.location, location)),
|
||||||
@ -49,13 +50,15 @@ function getSingleFileCoverageForTrace(
|
|||||||
branchCoverage[branchId] = isCovered;
|
branchCoverage[branchId] = isCovered;
|
||||||
}
|
}
|
||||||
const statementCoverage: StatementCoverage = {};
|
const statementCoverage: StatementCoverage = {};
|
||||||
for (const statementId of _.keys(coverageEntriesDescription.statementMap)) {
|
const statementIds = _.keys(coverageEntriesDescription.statementMap);
|
||||||
|
for (const statementId of statementIds) {
|
||||||
const statementDescription = coverageEntriesDescription.statementMap[statementId];
|
const statementDescription = coverageEntriesDescription.statementMap[statementId];
|
||||||
const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, statementDescription));
|
const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, statementDescription));
|
||||||
statementCoverage[statementId] = isCovered;
|
statementCoverage[statementId] = isCovered;
|
||||||
}
|
}
|
||||||
const functionCoverage: FunctionCoverage = {};
|
const functionCoverage: FunctionCoverage = {};
|
||||||
for (const fnId of _.keys(coverageEntriesDescription.fnMap)) {
|
const functionIds = _.keys(coverageEntriesDescription.fnMap);
|
||||||
|
for (const fnId of functionIds) {
|
||||||
const functionDescription = coverageEntriesDescription.fnMap[fnId];
|
const functionDescription = coverageEntriesDescription.fnMap[fnId];
|
||||||
const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, functionDescription.loc));
|
const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, functionDescription.loc));
|
||||||
functionCoverage[fnId] = isCovered;
|
functionCoverage[fnId] = isCovered;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user