Skip to content

Commit

Permalink
fix: added guard against empty coverage (#272)
Browse files Browse the repository at this point in the history
* fix: added guard against empty coverage

* fix: changed bounds check to perClassCovMap.size
  • Loading branch information
jeffb-sfdc authored Jan 14, 2022
1 parent 22c9014 commit 174bfab
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/apex-node/src/tests/syncTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,18 @@ export class SyncTests {
apexTestClassIdSet
);

result.tests.forEach(item => {
const keyCodeCov = `${item.apexClass.id}-${item.methodName}`;
const perClassCov = perClassCovMap.get(keyCodeCov);
perClassCov.forEach(classCov =>
coveredApexClassIdSet.add(classCov.apexClassOrTriggerId)
);
item.perClassCoverage = perClassCov;
});
if (perClassCovMap.size > 0) {
result.tests.forEach(item => {
const keyCodeCov = `${item.apexClass.id}-${item.methodName}`;
const perClassCov = perClassCovMap.get(keyCodeCov);
if (perClassCov) {
perClassCov.forEach(classCov =>
coveredApexClassIdSet.add(classCov.apexClassOrTriggerId)
);
item.perClassCoverage = perClassCov;
}
});
}

const {
codeCoverageResults,
Expand Down

0 comments on commit 174bfab

Please sign in to comment.