Skip to content

Conversation

@jfeingold35
Copy link
Contributor

What does this PR do?

Adds the new RunRelevantTests option to the Deploy Start and Deploy Validate commands

What issues does this PR fix or reference?

@W-20152151@

@jfeingold35 jfeingold35 requested a review from a team as a code owner November 10, 2025 18:19
@jfeingold35 jfeingold35 changed the title feat: added new RunRelevantTests test-level feat: added new RunRelevantTests test-level @W-20152151@ Nov 10, 2025
Copy link
Contributor

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jfeingold35 jfeingold35 merged commit 20e3d55 into main Nov 12, 2025
41 checks passed
@jfeingold35 jfeingold35 deleted the d/W-20152151 branch November 12, 2025 13:19
@cristiand391
Copy link
Member

QA comments:

--api-version < 65 throws invalid test level err:

➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --metadata ApexClass:GeocodingService --test-level RunRelevantTests -o jsforce-test-org --verbose  --metadata ApexClass:GeocodingServiceTest --api-version 65.0
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
Error (InvalidTestLevelSelection): TestLevel cannot be 'RunRelevantTests' unless API version is 66.0 or later

🟡 if --api-version isn't specified, validation doesn't happen but still get a good error msg from the org:

// code updated to pretty-print the options sent to the org

➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --metadata ApexClass:GeocodingService --test-level RunRelevantTests -o jsforce-test-org --verbose  --metadata ApexClass:GeocodingServiceTest
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
************************************************************************************************************************************************************************
{
  "rollbackOnError": true,
  "ignoreWarnings": false,
  "checkOnly": false,
  "singlePackage": true,
  "testLevel": "RunRelevantTests",
  "purgeOnDelete": false
}
************************************************************************************************************************************************************************
Error (1): 'RunRelevantTests' is not a valid value for the enum 'TestLevel'

✅ modified 2 apex test, then deployed with new test level and see it rans them 🪄

➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --metadata ApexClass:GeocodingService --test-level RunRelevantTests -o epic.out.2ee13979fc21@orgfarm.salesforce.com  --metadata ApexClass:GeocodingServiceTest
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.

 ─────────────── Deploying Metadata ───────────────

 Deploying v65.0 metadata to epic.out.2ee13979fc21@orgfarm.salesforce.com using the v66.0 SOAP API.

 ✔ Preparing 304ms
 ◯ Waiting for the org to respond - Skipped
 ✔ Deploying Metadata 797ms
   ▸ Components: 2/2 (100%)
 ✔ Running Tests 464ms
   ▸ Successful: 3/3 (100%)
   ▸ Failed: ⢀
 ◯ Updating Source Tracking - Skipped
 ✔ Done 0ms

 Status: Succeeded
 Deploy ID: 0AfSG00000LBzKD0A1
 Target Org: epic.out.2ee13979fc21@orgfarm.salesforce.com
 Elapsed Time: 1.56s


Deployed Source
  State       Name                   Type        Path
 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Unchanged   GeocodingService       ApexClass   force-app/main/default/classes/GeocodingService.cls
  Unchanged   GeocodingService       ApexClass   force-app/main/default/classes/GeocodingService.cls-meta.xml
  Changed     GeocodingServiceTest   ApexClass   force-app/main/default/classes/GeocodingServiceTest.cls
  Changed     GeocodingServiceTest   ApexClass   force-app/main/default/classes/GeocodingServiceTest.cls-meta.xml

same deploy skips tests, nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants