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

Commit

Permalink
feat(validate): add a markdown output for validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
azlam-abdulsalam committed Sep 1, 2023
1 parent 70122b6 commit bccbb58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/sfpowerscripts-cli/src/impl/validate/ValidateImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import ReleaseConfig from "../release/ReleaseConfig";
import { mapInstalledArtifactstoPkgAndCommits } from "../../utils/FetchArtifactsFromOrg";
import { ApexTestValidator } from "./ApexTestValidator";
import OrgInfoDisplayer from "../../ui/OrgInfoDisplayer";
import FileOutputHandler from "../../outputs/FileOutputHandler";


export enum ValidateAgainst {
Expand Down Expand Up @@ -707,6 +708,14 @@ export default class ValidateImpl implements PostDeployHook, PreDeployHook {
//Get Changed Components
const apextestValidator = new ApexTestValidator(targetUsername, sfpPackage, this.props, this.logger);
const testResult = await apextestValidator.validateApexTests();

if (!testResult.result) {
FileOutputHandler.getInstance().writeOutput(`validation-error.md`,`### 💣 Validation Failed 💣`);
FileOutputHandler.getInstance().appendOutput(`validation-error.md`,`Package validation failed for **${sfpPackage.packageName}**`);
FileOutputHandler.getInstance().appendOutput(`validation-error.md`,`Reasons:`);
FileOutputHandler.getInstance().appendOutput(`validation-error.md`,`${testResult.message}`);
}

return {
isToFailDeployment: !testResult.result,
message: testResult.message,
Expand Down

0 comments on commit bccbb58

Please sign in to comment.