Skip to content

Commit

Permalink
fix: don't need to track total covered lines in XML after adding break
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarvin8 committed Mar 6, 2024
1 parent 09e6b12 commit bc14f0c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/helpers/convertToGenericCoverageReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,22 @@ export function convertToGenericCoverageReport(data: CoverageData, dxDirectory:
for (const uncoveredLine of uncoveredLines) {
xml += `\t\t<lineToCover lineNumber="${uncoveredLine}" covered="false"/>\n`;
}
let totalCoveredLinesInXML = 0;

for (const coveredLine of coveredLines) {
if (coveredLine > totalLines) {
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
if (
!uncoveredLines.includes(randomLineNumber) &&
!coveredLines.includes(randomLineNumber) &&
!randomLines.includes(randomLineNumber) &&
totalCoveredLinesInXML < coveredLines.length
!randomLines.includes(randomLineNumber)
) {
xml += `\t\t<lineToCover lineNumber="${randomLineNumber}" covered="true"/>\n`;
randomLines.push(randomLineNumber);
totalCoveredLinesInXML++;
break;
}
}
} else {
xml += `\t\t<lineToCover lineNumber="${coveredLine}" covered="true"/>\n`;
totalCoveredLinesInXML++;
}
}

Expand Down

0 comments on commit bc14f0c

Please sign in to comment.