Skip to content

Commit

Permalink
Fix parsing when deployment failure is related to Apex code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Jan 7, 2025
1 parent a5c0961 commit ee34f37
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"csvfiles",
"currentgit",
"customindex",
"cvrg",
"dans",
"datacategorygroup",
"datacategorygroups",
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`

## [5.13.2] 2025-01-07

- [hardis:project:deploy:smart](https://sfdx-hardis.cloudity.com/hardis/project/deploy/smart/): Fix parsing when deployment failure is related to Apex code coverage
- Flow doc fix: add description for constants, variables, text template & formulas
- Flow parsing: Fix error when there is only one formula

Expand Down
31 changes: 24 additions & 7 deletions src/common/utils/deployTipJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,30 @@ export async function analyzeDeployErrorLogsJson(resultJson: any, log: string, i

// Fallback in case we have not been able to identify errors
if (errorsAndTips.length === 0 && failedTests.length === 0) {
errorsAndTips.push(({
error: { message: "There has been an issue parsing errors, please notify sfdx-hardis maintainers" },
tip: {
label: "SfdxHardisInternalError",
message: "Declare issue on https://github.com/hardisgroupcom/sfdx-hardis/issues",
},
}))
// Check if there are code coverage warnings
if (resultJson?.result?.details?.runTestResult?.codeCoverageWarnings?.length > 0) {
for (const cvrgWarning of resultJson.result.details.runTestResult.codeCoverageWarnings) {
const coverageErrorMsg = (cvrgWarning.name ? `${cvrgWarning.name} :` : "") + cvrgWarning.message;
errorsAndTips.push(({
error: { message: coverageErrorMsg },
tip: {
label: "CodeCoverageWarning",
message: "Please fix code coverage so your deployment can pass",
docUrl: "https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_code_coverage_intro.htm",
},
}))
}
}
else {
// Or add default error message
errorsAndTips.push(({
error: { message: "There has been an issue parsing errors, please notify sfdx-hardis maintainers" },
tip: {
label: "SfdxHardisInternalError",
message: "Declare issue on https://github.com/hardisgroupcom/sfdx-hardis/issues",
},
}))
}
}

// Create output log for errors
Expand Down

0 comments on commit ee34f37

Please sign in to comment.