2

Is there a way to run packaged or org tests when we install a Managed/Unlocked SFDX package to an org using sfdx force:package:install?

  • 2
    I asked Dileep about this, specifically in the context of rolling back the installation on failure. He said it was a good idea and they would look at implementing it. So, not possible today – Aidan Apr 3 at 11:18
3

So far you can't. The only thing you can run is Apex Classes compilation with the --apexcompile flag.

However, starting Winter 21, code coverage should be enforced for Unlocked Packages installation.

The original post from PM Dileep Burki is available here, feel free to go there and give your thoughts about it.

Enforcement of Code Coverage in Unlocked Packages
One of the issues many of you have raised in the past is a lack of enforcement of code coverage when it comes to Unlocked Packages. We all know the value of well-written tests when we package Apex. Starting Winter ’21, we want to enforce 75% code coverage. You will be able to create unlocked package versions even if code coverage is less than 75%, but such package versions can only be installed in scratch orgs and non-production orgs. In order to promote a package version from beta to released, you will have to have a minimum of 75% code coverage. You can choose to run code coverage during package version creation by supplying the optional --codecoverage parameter. Starting Summer ’20, in the CLI, we will show a warning that this change is coming. We believe a 4+ month notification is sufficient for you to get prepared for this change. Please let us know your thoughts and comments.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.