Skip to content

Commit 12d8b80

Browse files
committed
feat: added new RunRelevantTests test-level
1 parent 21acab8 commit 12d8b80

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

messages/deploy.metadata.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ Valid values are:
104104

105105
- RunAllTestsInOrg — All tests in your org are run, including tests of managed packages.
106106

107+
- RunRelevantTests — Runs only tests that are relevant to the files being deployed.
108+
107109
If you don’t specify a test level, the default behavior depends on the contents of your deployment package and target org. For more information, see [Running Tests in a Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_running_tests.htm) in the "Metadata API Developer Guide".
108110

109111
# flags.source-dir.summary
@@ -261,4 +263,4 @@ The `pushPackageDirectoriesSequentially` property is not respected by this comma
261263
# noSourceTrackingWarning
262264

263265
Starting in December 2025, this command will require that the target org use source tracking.
264-
Specifically, to use this command with a production org, scratch org created with the `--no-track-source` flag, or other non-source-tracking org, you must specify the metadata you want to deploy with either the `--metadata`, `--source-dir`, or `--manifest` flag.
266+
Specifically, to use this command with a production org, scratch org created with the `--no-track-source` flag, or other non-source-tracking org, you must specify the metadata you want to deploy with either the `--metadata`, `--source-dir`, or `--manifest` flag.

messages/deploy.metadata.validate.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Valid values are:
5252

5353
- RunAllTestsInOrg — All tests in your org are run, including tests of managed packages.
5454

55+
- RunRelevantTests — Runs only tests that are relevant to the files being deployed.
56+
5557
# flags.source-dir.summary
5658

5759
Path to the local source files to validate for deployment.

src/commands/project/deploy/start.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
122122
'test-level': testLevelFlag({
123123
description: messages.getMessage('flags.test-level.description'),
124124
summary: messages.getMessage('flags.test-level.summary'),
125-
options: [TestLevel.NoTestRun, TestLevel.RunSpecifiedTests, TestLevel.RunLocalTests, TestLevel.RunAllTestsInOrg],
125+
options: [
126+
TestLevel.NoTestRun,
127+
TestLevel.RunSpecifiedTests,
128+
TestLevel.RunLocalTests,
129+
TestLevel.RunAllTestsInOrg,
130+
TestLevel.RunRelevantTests,
131+
],
126132
helpGroup: testFlags,
127133
}),
128134
verbose: Flags.boolean({

src/commands/project/deploy/validate.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ export default class DeployMetadataValidate extends SfCommand<DeployResultJson>
9696
'target-org': Flags.requiredOrg(),
9797
tests: testsFlag({ helpGroup: testFlags }),
9898
'test-level': testLevelFlag({
99-
options: [TestLevel.RunAllTestsInOrg, TestLevel.RunLocalTests, TestLevel.RunSpecifiedTests],
99+
options: [
100+
TestLevel.RunAllTestsInOrg,
101+
TestLevel.RunLocalTests,
102+
TestLevel.RunSpecifiedTests,
103+
TestLevel.RunRelevantTests,
104+
],
100105
default: TestLevel.RunLocalTests,
101106
description: messages.getMessage('flags.test-level.description'),
102107
summary: messages.getMessage('flags.test-level.summary'),

src/utils/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export enum TestLevel {
3535
RunSpecifiedTests = 'RunSpecifiedTests',
3636
RunLocalTests = 'RunLocalTests',
3737
RunAllTestsInOrg = 'RunAllTestsInOrg',
38+
RunRelevantTests = 'RunRelevantTests',
3839
}
3940

4041
export enum API {

0 commit comments

Comments
 (0)