Code Coverage for Unlocked 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 can take longer to complete when code coverage is being computed, so consider when in the development cycle to include the code coverage parameter. You can choose to skip code coverage, and you can skip all validation by specifying the --skip-validation parameter. You can promote package versions only if they’re validated and meet code coverage requirements.
View code coverage information for a package version using sf package version list with the --verbose parameter, or the sf package version report command in Salesforce CLI.
We don’t calculate code coverage for org-dependent unlocked packages.