Skip to content

Commit

Permalink
fix: handle running test class with no tests (#149)
Browse files Browse the repository at this point in the history
@W-8980718@
  • Loading branch information
AnanyaJha authored and rcoringrato-sfdc committed Mar 18, 2021
1 parent bdd93d6 commit 4619908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/apex-node/src/tests/testService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,10 @@ export class TestService {
public async getPerClassCodeCoverage(
apexTestClassSet: Set<string>
): Promise<Map<string, PerClassCoverage[]>> {
if (apexTestClassSet.size === 0) {
return new Map();
}

let str = '';
apexTestClassSet.forEach(elem => {
str += `'${elem}',`;
Expand Down
6 changes: 1 addition & 5 deletions packages/apex-node/test/tests/codeCoverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,7 @@ describe('Get code coverage results', () => {
});

it('should return per class coverage for test that covers 0 classes', async () => {
toolingQueryStub.resolves({
done: true,
totalSize: 0,
records: []
} as ApexCodeCoverage);
toolingQueryStub.throws('Error at Row:1;Column:1');
const testSrv = new TestService(mockConnection);
const perClassCoverageMap = await testSrv.getPerClassCodeCoverage(
new Set<string>([])
Expand Down

0 comments on commit 4619908

Please sign in to comment.