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

Commit

Permalink
fix(deploy): select the correct testlevel while deploying to prod (#993)
Browse files Browse the repository at this point in the history
Test levels are incorrect when the package doesnt have any apex tests or when optimized deployment
was set to false

fix #992
  • Loading branch information
azlam-abdulsalam authored May 27, 2022
1 parent 65f487b commit 73ce72e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/deployers/DeploySourceToOrgImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ export default class DeploySourceToOrgImpl implements DeploymentExecutor {
metdataDeployOptions.apiOptions.testLevel = TestLevel.RunSpecifiedTests;
let apexTestSuite = new ApexTestSuite(sourceDir, this.deploymentOptions.apexTestSuite);
metdataDeployOptions.apiOptions.runTests = await apexTestSuite.getConstituentClasses();
} else if (this.deploymentOptions.testLevel == TestLevel.RunSpecifiedTests) {
} else if (this.deploymentOptions.testLevel == TestLevel.RunLocalTests) {
metdataDeployOptions.apiOptions.testLevel = TestLevel.RunLocalTests;
}
else if (this.deploymentOptions.testLevel == TestLevel.RunSpecifiedTests) {
metdataDeployOptions.apiOptions.testLevel = TestLevel.RunSpecifiedTests;
metdataDeployOptions.apiOptions.runTests = this.deploymentOptions.specifiedTests.split(`,`);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export default class InstallSourcePackageImpl extends InstallPackage {
this.logger
);

deploymentOptions.testLevel = TestLevel.RunNoTests;
deploymentOptions.testLevel = TestLevel.RunLocalTests;
return deploymentOptions;
}

Expand All @@ -444,7 +444,7 @@ export default class InstallSourcePackageImpl extends InstallPackage {
}
} else if (this.sfpPackage.isApexFound) {
if (this.sfpPackage.isTriggerAllTests) {
deploymentOptions.testLevel = TestLevel.RunAllTestsInPackage;
deploymentOptions.testLevel = TestLevel.RunLocalTests;
} else if (this.sfpPackage.apexTestClassses?.length > 0 && optimizeDeployment) {
deploymentOptions.testLevel = TestLevel.RunSpecifiedTests;
deploymentOptions.specifiedTests = this.getAStringOfSpecificTestClasses(
Expand Down

0 comments on commit 73ce72e

Please sign in to comment.