Closed alanjaouen closed 12 months ago
@alanjaouen Its is an expected behaviour, tests are run after deployment in validate, Isnt if running in that mod
@azlam-abdulsalam the validate end with success right after the deployment, without running tests for this package
previously (in 21.1.0) for source package with isOptimizedDeployment
to false
, tests where run during deployment
I tried to find what changed between 21.1.0 related and current, but didn't find anything relevant :/ https://github.com/dxatscale/sfpowerscripts/compare/@dxatscale/sfpowerscripts@21.1.0...@dxatscale/sfpowerscripts@25.0.6
After deep diving in the code, I found something:
This is the line specifying to not run the apex tests when optimized deployment is false
https://github.com/dxatscale/sfpowerscripts/blob/ab1a369076fc08f600fc7510321aaf743d05c908/packages/sfpowerscripts-cli/src/impl/validate/ApexTestValidator.ts#L38-L43
But the tests doesn't run previously because the only moment they can run is when the package is deployed
In the DeployImpl, it specify to not skip the tests during a validate of a source package without optimized deployment:
https://github.com/dxatscale/sfpowerscripts/blob/ab1a369076fc08f600fc7510321aaf743d05c908/packages/sfpowerscripts-cli/src/impl/deploy/DeployImpl.ts#L747-L762
Then it regenerate of the settings of the deploy here:
https://github.com/dxatscale/sfpowerscripts/blob/ab1a369076fc08f600fc7510321aaf743d05c908/packages/core/src/package/packageInstallers/InstallSourcePackageImpl.ts#L70-L77
And then, when setting up the deploy, it specify that there is no tests to run in the case of a source package deployed on a Scratch Org for validation:
We go in this else because this.options.isInstallingForValidation == true
:
https://github.com/dxatscale/sfpowerscripts/blob/ab1a369076fc08f600fc7510321aaf743d05c908/packages/core/src/package/packageInstallers/InstallPackage.ts#L471-L478
And because we deploy in SO, we have orgDetails.isSandbox == true
This is the explanation of the issue I was able to find I can't understand why it was working previously
Possible ways to fix:
if (this.sfpPackage.packageDescriptor.isOptimizedDeployment == false)
, probably not the best solutionwow! great investigation @nabondance . Very helpful! Let me have a look into it
Describe the bug during a validate, source package are deployed without running test
To Reproduce Steps to reproduce the behavior: package descriptor:
Expected behavior during validate, metadata should be deploy and test should be launched
Screenshots If applicable, add screenshots to help explain your problem.
Platform Details (please complete the following information):
Additional context complete log: