Configure Apex test levels for deletions
mainWhen deleting components that include Apex, you can specify a --test-level to control how tests are run in the target org.
Available options for --test-level:
NoTestRun: No tests are run. Default for development environments (sandbox, Developer Edition, etc.).RunSpecifiedTests: Runs only the tests specified via the--testsflag. Requires minimum 75% code coverage for each class/trigger in the package.RunLocalTests: Runs all tests in the org except those from installed managed/unlocked packages. Default for production deployments.RunAllTestsInOrg: Runs all tests in the org, including managed packages.RunRelevantTests(Beta): Runs only tests relevant to the files being deployed based on dependency analysis.
# Example: Running specific tests during a deletion
$ sf project delete source --metadata ApexClass --test-level RunSpecifiedTests --tests TestClass1 TestClass2