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

Add diffcheck flag to validate commands #911

Merged
merged 12 commits into from
Mar 29, 2022
Merged
33,510 changes: 16,755 additions & 16,755 deletions packages/core/package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions packages/core/src/apextest/JSONReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ const skippedProperties = ['skipRate', 'coveredLines', 'totalLines'];
const timeProperties = ['testExecutionTimeInMs', 'testTotalTimeInMs', 'commandTimeInMs'];

export class JsonReporter {
public format(
result: TestResult
): {
public format(result: TestResult): {
summary: object;
tests: CliTestResult[];
coverage?: CliCoverageResult;
Expand Down
11 changes: 5 additions & 6 deletions packages/core/src/apextest/TriggerApexTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ export default class TriggerApexTests {
//Fetch Test Results
let testResult = await retry(
async (bail) => {
return await testService.reportAsyncResults(
return await testService.reportAsyncResults(
testRunResult.summary.testRunId,
true,
this.cancellationTokenSource.token
);
}, { retries: 2, minTimeout: 3000 });

},
{ retries: 2, minTimeout: 3000 }
);

this.writeTestOutput(testResult);
//Collect Failed Tests only if Parallel
Expand Down Expand Up @@ -503,9 +504,7 @@ export default class TriggerApexTests {
return result;
}

private async validateForApexCoverage(
coverageReport: any
): Promise<{
private async validateForApexCoverage(coverageReport: any): Promise<{
result: boolean;
message?: string;
packageTestCoverage?: number;
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/artifacts/ArtifactInquirer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export default class ArtifactInquirer {
* Gets latest package manifest from artifacts
* Returns null if unable to find latest package manifest
*/
private getLatestPackageManifestFromArtifacts(
artifacts: ArtifactFilePaths[]
): {
private getLatestPackageManifestFromArtifacts(artifacts: ArtifactFilePaths[]): {
latestPackageManifest: any;
pathToLatestPackageManifest: string;
} {
Expand Down
17 changes: 9 additions & 8 deletions packages/core/src/iprange/RelaxIPRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ export default class RelaxIPRange {
let deployId: AsyncResult;

var zipStream = fs.createReadStream(zipFile);
await conn.metadata.deploy(zipStream, { rollbackOnError: true, singlePackage: true }, function (
error,
result: AsyncResult
) {
if (error) {
return console.error(error);
await conn.metadata.deploy(
zipStream,
{ rollbackOnError: true, singlePackage: true },
function (error, result: AsyncResult) {
if (error) {
return console.error(error);
}
deployId = result;
}
deployId = result;
});
);

let metadata_deploy_result: DeployResult = await this.checkDeploymentStatus(conn, deployId.id);

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/package/SFPPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ export default class SFPPackage {
sfpPackage._isApexInPackage = packageManifest.isApexInPackage();
sfpPackage._isProfilesInPackage = packageManifest.isProfilesInPackage();
sfpPackage._isPermissionSetGroupInPackage = packageManifest.isPermissionSetGroupsFoundInPackage();
sfpPackage._isProfileSupportedMetadataInPackage = packageManifest.isPayLoadContainTypesSupportedByProfiles();
sfpPackage._isProfileSupportedMetadataInPackage =
packageManifest.isPayLoadContainTypesSupportedByProfiles();

let apexFetcher: ApexTypeFetcher = new ApexTypeFetcher(sfpPackage._mdapiDir);

Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/package/coverage/PackageTestCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export default class PackageTestCoverage {
return testCoverage;
}

public async validateTestCoverage(
coverageThreshold?: number
): Promise<{
public async validateTestCoverage(coverageThreshold?: number): Promise<{
result: boolean;
message?: string;
packageTestCoverage: number;
Expand Down
24 changes: 16 additions & 8 deletions packages/core/src/package/packageInstallers/InstallPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export abstract class InstallPackage {
protected packageDescriptor;
protected packageDirectory;
protected org: SFPOrg;
private isArtifactToBeCommitted: boolean = true;

public constructor(
protected sfdxPackage: string,
Expand Down Expand Up @@ -139,15 +140,22 @@ export abstract class InstallPackage {
});
}

//Set this to disable whethere info about the artifact has to be recorded in the org
public set disableArtifactCommit(disableArtifactCommit: boolean) {
azlam-abdulsalam marked this conversation as resolved.
Show resolved Hide resolved
this.isArtifactToBeCommitted = !disableArtifactCommit;
}

private async commitPackageInstallationStatus() {
try {
await this.org.updateArtifactInOrg(this.logger, this.packageMetadata);
} catch (error) {
SFPLogger.log(
'Unable to commit information about the package into org..Check whether prerequisities are installed',
LoggerLevel.WARN,
this.logger
);
if (this.isArtifactToBeCommitted) {
try {
await this.org.updateArtifactInOrg(this.logger, this.packageMetadata);
} catch (error) {
SFPLogger.log(
'Unable to commit information about the package into org..Check whether prerequisities are installed',
LoggerLevel.WARN,
this.logger
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,13 @@ export default class InstallSourcePackageImpl extends InstallPackage {
isReconcileErrored = false;
let profileFolders;
if (this.packageMetadata.isProfilesFound && this.packageMetadata.reconcileProfiles !== false) {
({
profileFolders,
isReconcileActivated,
isReconcileErrored,
} = await this.reconcileProfilesBeforeDeployment(
profileFolders,
this.sourceDirectory,
this.targetusername,
tempDir
));
({ profileFolders, isReconcileActivated, isReconcileErrored } =
await this.reconcileProfilesBeforeDeployment(
profileFolders,
this.sourceDirectory,
this.targetusername,
tempDir
));

//Reconcile Failed, Bring back the original profiles
if (isReconcileErrored && profileFolders.length > 0) {
Expand Down
Loading