Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
fix(namespace): fix namespaces on reported class names
Browse files Browse the repository at this point in the history
Related to: #1362
  • Loading branch information
JonnyPower committed Jul 21, 2023
1 parent 19af0fd commit a552105
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions packages/core/src/apextest/TriggerApexTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export default class TriggerApexTests {
{ retries: 2, minTimeout: 3000 }
);

testResult = this.fixBadNamespaceClassFullNames(testResult);

//Collect Failed Tests only if Parallel
testResult = await this.triggerSecondRunInSerialForParallelFailedTests(
testResult,
Expand Down Expand Up @@ -401,11 +403,15 @@ export default class TriggerApexTests {
{ retries: 2, minTimeout: 3000 }
);

secondRuntestRunResult = this.fixBadNamespaceClassFullNames(secondRuntestRunResult);

//Fetch Test Results
const secondTestResult = await testService.reportAsyncResults(
secondRuntestRunResult.summary.testRunId,
true,
this.cancellationTokenSource.token
const secondTestResult = this.fixBadNamespaceClassFullNames(
await testService.reportAsyncResults(
secondRuntestRunResult.summary.testRunId,
true,
this.cancellationTokenSource.token
)
);

this.writeTestOutput(secondTestResult);
Expand All @@ -430,6 +436,27 @@ export default class TriggerApexTests {
return modifiedTestResult;
}

private fixBadNamespaceClassFullNames(testResult: any): any {
let modifiedTestResult = _.cloneDeep(testResult);

modifiedTestResult.tests = modifiedTestResult.tests.map((test) => {
return {
...test,
...{
fullName: test.fullName.replace('__', '.'),
apexClass: {
...test.apexClass,
...{
fullName: test.apexClass.fullName.replace('__', '.'),
},
},
},
};
});

return modifiedTestResult;
}

private combineTestResult(testResult: TestResult, testResultSecondRun?: TestResult) {
testResult.summary.failing = 0;
testResult.summary.passing = 0;
Expand Down

0 comments on commit a552105

Please sign in to comment.