Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Code Coverage for Second-Generation Managed Packages
To compute code coverage using Salesforce CLI, use the --code-coverage parameter when you run the sf package version create command.
Package version creation often takes longer to complete when code coverage is being computed, so consider when to include the code coverage parameter. You can create beta package versions without computing code coverage, but these beta versions can’t be promoted.
If you try to promote a beta package version to managed-released and the version was created without specifying code coverage, or the code coverage in the package version is less than 75%, the package promotion fails. Code coverage is calculated during package version validation. If you skip validation using the --skip-validation parameter, code coverage isn’t calculated for that package version.
View code coverage information for a package version using sf package version list with the --verbose parameter, or sf package version report command in Salesforce CLI.