Get Ready for Unlocked Package Code Coverage Enforcement

Computing code coverage helps validate that the Apex code in your unlocked packages has adequate test coverage. Starting in Winter ‘21, a minimum 75% code coverage is required for package version promotion. Package versions created in Winter ‘21 and later, that don’t meet this code coverage, can only be installed in scratch orgs and sandboxes.

Where: This change applies to unlocked package versions created using Salesforce CLI or Tooling API.

When: This change takes effect in Winter ‘21. Unlocked package versions that are promoted to the released state before Winter ‘21 won’t be subject to code coverage requirements.

How: You can use the CalculateCodeCoverage field in the Package2VersionCreateRequest object or the codecoverage CLI parameter on the force:package:version:create when you create a package version.