You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,11 @@
4
4
5
5
The `apex-tests-git-delta` is a Salesforce CLI plugin to take 2 commit SHAs in a Salesforce DX git repository and return the delta Apex tests to run against when executing a delta deployment.
6
6
7
-
The tests are determined by looking at all commit messages in the commit range and extracting them with a regular expression defined in a text file.
7
+
The tests are determined by looking at all commit messages in the commit range and extracting them with a regular expression defined in a config file.
8
8
9
-
For example, if the user creates a file named `regex.txt` in their repository with the below regular expression, the plugin will extract all test classes that are found with this expression and return a space-separated string with unique test classes.
9
+
You must add a config file named `.apextestsgitdeltarc` in the root folder of your repository with your regular expression.
10
+
11
+
For example, your `.apextestsgitdeltarc` file can contain the regular expression:
10
12
11
13
```
12
14
[Aa][Pp][Ee][Xx]::(.*?)::[Aa][Pp][Ee][Xx]
@@ -33,7 +35,7 @@ You could then save the contents of this text file to a variable and use that va
33
35
```
34
36
sf apex-tests-git-delta delta --from "c7603c25581afe7c443c57e687f2d6abd654ea77" --to "HEAD" --output "runTests.txt"
35
37
testclasses=$(<runTests.txt)
36
-
sf project deploy start -x manifest/package.xml -l RunSpecifiedTests -t $testclasses
38
+
sf project deploy start -x package/package.xml -l RunSpecifiedTests -t $testclasses
37
39
```
38
40
39
41
**NOTE:** The test classes will only be added to the output if they are found in one of your package directories as listed in the `sfdx-project.json` in the `--to` commit's file-tree. If the test class name was not found in any package directory, a warning will be printed to the terminal. The plugin will not fail if no test classes are included in the final output. The output and text file will simply be empty if no delta test classes were found in any commit message or no test classes were validated against a package directory.
@@ -66,12 +68,11 @@ This command will determine the root folder of the repo and look for the `sfdx-p
-f, --from=<value> Commit SHA from where the commit message log is done. This SHA's commit message will not be included in the results.
73
75
-t, --to=<value> [default: HEAD] Commit SHA to where the commit message log is done.
74
-
-e, --regular-expression=<value> [default: regex.txt] The text file containing the Apex Tests regular expression to search for.
75
76
--output=<value> [default: runTests.txt] The text file to save the delta test classes to.
76
77
77
78
GLOBAL FLAGS
@@ -81,5 +82,5 @@ DESCRIPTION
81
82
Given 2 git commits, this plugin will parse all of the commit messages between this range and return the delta Apex test class string. This can be used to execute delta deployments.
0 commit comments