Skip to content

"Always provide a classes, suites, tests, or testLevel property." when running sfdx force:apex:test:run -l RunLocalTests on a project with no tests #282

Description

@fransf-wtax

Summary

SFDX exits with the following error when running sfdx force:apex:test:run -l RunLocalTests on a project with no tests:

ERROR running force:apex:test:run: Always provide a classes, suites, tests, or testLevel property.

Since -l sets the testLevel property, the error message is wrong (testLevel was provided). In the case where there are no local tests and RunLocalTests is set as test level, the call should just complete without doing anything.

Steps To Reproduce:

  1. Run sfdx force:apex:test:run -l RunLocalTests in a DX project that has no tests, with the scratch org already created and set as the default username.

Expected result

All local tests are run (which is no tests in an org with no local tests).

Actual result

ERROR running force:apex:test:run:  Always provide a classes, suites, tests, or testLevel property.

error is returned.

System Information

{
	"cliVersion": "sfdx-cli/7.123.0",
	"architecture": "darwin-x64",
	"nodeVersion": "node-v14.18.1",
	"pluginVersions": [
		"@assisisolutions/sfdx-ci-plugin 1.0.1",
		"@oclif/plugin-autocomplete 0.3.0 (core)",
		"@oclif/plugin-commands 1.3.0 (core)",
		"@oclif/plugin-help 3.2.3 (core)",
		"@oclif/plugin-not-found 1.2.4 (core)",
		"@oclif/plugin-plugins 1.10.1 (core)",
		"@oclif/plugin-update 1.5.0 (core)",
		"@oclif/plugin-warn-if-update-available 1.7.0 (core)",
		"@oclif/plugin-which 1.0.3 (core)",
		"alias 1.1.22 (core)",
		"auth 1.7.3 (core)",
		"config 1.2.41 (core)",
		"generator 1.2.0 (core)",
		"salesforcedx 52.0.0",
		"├─ data 0.4.11",
		"├─ apex 0.2.2",
		"├─ schema 1.0.7",
		"├─ custom-metadata 1.0.12",
		"├─ templates 51.5.0",
		"├─ org 1.6.6",
		"├─ limits 1.2.1",
		"├─ user 1.3.0",
		"├─ salesforce-alm 52.0.0",
		"└─ @salesforce/sfdx-plugin-lwc-test 0.1.7",
		"sfdx-cli 7.123.0 (core)",
		"source 1.2.4 (core)",
		"telemetry 1.2.8 (core)",
		"texei-sfdx-plugin 1.11.1",
		"trust 1.0.8 (core)"
	],
	"osVersion": "Darwin 19.6.0"
}

Additional information

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions