Newer Version Available

This content describes an older version of this product. View Latest

Code Coverage for Unlocked Packages

Although code coverage isn’t enforced for unlocked packages, it’s a best practice to include Apex tests in your unlocked packages.

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. Unlocked package versions that are promoted to the released state before Winter ‘21 won’t be subject to code coverage requirements.

Important

To compute code coverage using Salesforce CLI, use the --codecoverage parameter when you run the force:package:version:create command.

Package version creation may take longer to complete when code coverage is being computed, so consider when to include the code coverage parameter.

View code coverage information for a package version using force:package:version:list with the --verbose parameter, or force:package:version:reportcommand in Salesforce CLI.