Skip to content

fix: default validate test-level to RunSpecifiedTests when --tests set - #1650

Open
mcarvin8 wants to merge 1 commit into
salesforcecli:mainfrom
mcarvin8:fix/validate-implicit-run-specified-tests
Open

mcarvin8 wants to merge 1 commit into
salesforcecli:mainfrom
mcarvin8:fix/validate-implicit-run-specified-tests

Conversation

@mcarvin8

@mcarvin8 mcarvin8 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

sf project deploy validate overrode the shared testLevelFlag default (src/utils/flags.ts), which sets --test-level to RunSpecifiedTests when --tests is passed, with a static default: TestLevel.RunLocalTests.

As a result, sf project deploy validate --tests MyTest (without --test-level) sent runTests=[MyTest] with testLevel=RunLocalTests, and the Metadata API rejected the request:

INVALID_OPERATION: runTests can only be used with a testLevel of RunSpecifiedTests

sf project deploy start does not override the default, so it already handles this case. This PR makes validate behave the same way:

  • --tests passed, no --test-level: the level defaults to RunSpecifiedTests
  • no --tests: the level defaults to RunLocalTests, as before
  • explicit --test-level: still wins

It also updates the --test-level help text for validate to describe the conditional default.

The workaround for this is to explicitly set test level to RunSpecifiedTests when running the validate command with --tests.

What issues does this PR fix or reference?

Users must currently pass --test-level RunSpecifiedTests explicitly with validate, even though the docs suggest --tests implies it.

🤖 Generated with Claude Code

project deploy validate overrode the shared testLevelFlag default with a
static RunLocalTests, so passing --tests without --test-level sent
runTests with testLevel=RunLocalTests and the Metadata API rejected it:
"INVALID_OPERATION: runTests can only be used with a testLevel of
RunSpecifiedTests". Match project deploy start's behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jshackell-sfdc jshackell-sfdc left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My approval is for only the updated message (I'm a writer :-) )

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants