Skip to content

Bug: "sf project deploy start" parses --test-level incorrectly when combined with multiple tests via -t #3453

@EmilioCarrelon99

Description

@EmilioCarrelon99

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

I am encountering a parsing error when running sf project deploy start. I am trying to run specified tests using -l RunSpecifiedTests followed by a space-separated list of tests using -t.

The CLI seems to interpret the -t flag and the subsequent test names as part of the string value for the -l (test-level) flag, causing a validation error

Steps To Reproduce

IMPORTANT
Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue.
We may close your issue if you don't include proper instructions.

  • Generate a project with sf project generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.

Tip

use sf doctor --create-issue to automatically fill the required information

Steps To Reproduce
Execute the following command (passing multiple tests via command line or variable):

Bash

sf project deploy start -d force-app/main/default -o TARGET_ORG -l RunSpecifiedTests -t TestClass1 TestClass2 TestClass3 TestClass4 TestClass5 --dry-run -w 60
Note: This often happens when passing the flags via a shell variable that is improperly quoted during execution.

Expected result
The command should accept RunSpecifiedTests as the value for -l and then process the list of tests provided after -t separately.

Actual result
The command fails immediately with an argument validation error. It appears to be reading the entire string after -l as a single argument including the test names.

Error Output:

Plaintext

Error (1): Expected --test-level= RunSpecifiedTests -t TestClass1 TestClass2 TestClass3 TestClass4 TestClass5 --dry-run to be one of: NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg

System Information

bash 2.109.7
PASTE_VERSION_OUTPUT_HERE

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingWe're actively investigating this issuevalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions