@salesforce/plugin-apex 3.7.1 → 3.8.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE.txt +200 -6
  2. package/README.md +152 -12
  3. package/lib/commands/apex/get/log.js +13 -4
  4. package/lib/commands/apex/get/log.js.map +1 -1
  5. package/lib/commands/apex/get/test.js +13 -4
  6. package/lib/commands/apex/get/test.js.map +1 -1
  7. package/lib/commands/apex/list/log.js +13 -4
  8. package/lib/commands/apex/list/log.js.map +1 -1
  9. package/lib/commands/apex/run/test.d.ts +3 -8
  10. package/lib/commands/apex/run/test.js +33 -96
  11. package/lib/commands/apex/run/test.js.map +1 -1
  12. package/lib/commands/apex/run.js +13 -4
  13. package/lib/commands/apex/run.js.map +1 -1
  14. package/lib/commands/apex/tail/log.js +13 -4
  15. package/lib/commands/apex/tail/log.js.map +1 -1
  16. package/lib/commands/logic/get/test.d.ts +1 -0
  17. package/lib/commands/logic/get/test.js +14 -4
  18. package/lib/commands/logic/get/test.js.map +1 -1
  19. package/lib/commands/logic/run/test.d.ts +28 -0
  20. package/lib/commands/logic/run/test.js +130 -0
  21. package/lib/commands/logic/run/test.js.map +1 -0
  22. package/lib/flags.js +13 -4
  23. package/lib/flags.js.map +1 -1
  24. package/lib/index.js +13 -4
  25. package/lib/index.js.map +1 -1
  26. package/lib/logColorize.js +13 -4
  27. package/lib/logColorize.js.map +1 -1
  28. package/lib/reporters/index.js +13 -4
  29. package/lib/reporters/index.js.map +1 -1
  30. package/lib/reporters/jsonReporter.js.map +1 -1
  31. package/lib/reporters/runReporter.js +13 -4
  32. package/lib/reporters/runReporter.js.map +1 -1
  33. package/lib/reporters/testReporter.js +14 -5
  34. package/lib/reporters/testReporter.js.map +1 -1
  35. package/lib/shared/TestGetBase.js +13 -4
  36. package/lib/shared/TestGetBase.js.map +1 -1
  37. package/lib/shared/TestRunService.d.ts +61 -0
  38. package/lib/shared/TestRunService.js +161 -0
  39. package/lib/shared/TestRunService.js.map +1 -0
  40. package/messages/logicgettest.md +3 -3
  41. package/messages/runlogictest.md +51 -0
  42. package/messages/runtest.md +2 -33
  43. package/messages/runtestcommon.md +40 -0
  44. package/oclif.manifest.json +260 -5
  45. package/package.json +10 -6
@@ -569,7 +569,7 @@
569
569
  ],
570
570
  "args": {},
571
571
  "deprecateAliases": true,
572
- "description": "Specify which tests to run by using the --class-names, --suite-names, or --tests flags. Alternatively, use the --test-level flag to run all the tests in your org, local tests, or specified tests.\n\nTo see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.\n\nBy default, Apex tests run asynchronously and immediately return a test run ID. You can use the --wait flag to specify the number of minutes to wait; if the tests finish in that timeframe, the command displays the results. If the tests haven't finished by the end of the wait time, the command displays a test run ID. Use the \"<%= config.bin %> apex get test --test-run-id\" command to get the results.\n\nYou must have the \"View All Data\" system permission to use this command. The permission is disabled by default and can be enabled only by a system administrator.\n\nNOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the covered lines and total lines from all the Apex classes evaluated by the tests in this run.",
572
+ "description": "Specify which tests to run by using the --class-names, --suite-names, or --tests flags. Alternatively, use the --test-level flag to run all the tests in your org, local tests, or specified tests.\n\nTo see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.\n\nBy default, Apex tests run asynchronously and immediately return a test run ID. You can use the --wait flag to specify the number of minutes to wait; if the tests finish in that timeframe, the command displays the results. If the tests haven't finished by the end of the wait time, the command displays a test run ID. Use the \"<%= config.bin %> apex get test --test-run-id\" command to get the results.\n\nTo run both Apex and Flow tests together, run the \"sf logic run test\" CLI command, which has similar flags as this command, but expands the --tests flag to also include Flow tests.\n\nYou must have the \"View All Data\" system permission to use this command. The permission is disabled by default and can be enabled only by a system administrator.\n\nNOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the covered lines and total lines from all the Apex classes evaluated by the tests in this run.",
573
573
  "examples": [
574
574
  "Run all Apex tests and suites in your default org:\n<%= config.bin %> <%= command.id %>",
575
575
  "Run the specified Apex test classes in your default org and display results in human-readable form:\n<%= config.bin %> <%= command.id %> --class-names MyClassTest --class-names MyOtherClassTest --result-format human",
@@ -980,10 +980,10 @@
980
980
  "logic:get:test": {
981
981
  "aliases": [],
982
982
  "args": {},
983
- "description": "When you run 'sf logic run test' to test Apex classes and Flows asynchronously, it returns a test run ID. Use that ID with this command to see the results.\n\nTo see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.",
983
+ "description": "When you run \"sf logic run test\" to test Apex classes, Flows, and Agentforce agents asynchronously, it returns a test run ID. Use that ID with this command to see the results.\n\nTo see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.",
984
984
  "examples": [
985
- "Get the results for a specific test run ID in the default human-readable format; uses your default org:\n<%= config.bin %> <%= command.id %> --test-run-id <test run id>",
986
- "Get the results for a specific test run ID, format them as JUnit, and save them to the \"test-results/junit\" directory; uses the org with alias \"my-scratch\":\n<%= config.bin %> <%= command.id %> --test-run-id <test run id> --result-format junit --target-org my-scratch"
985
+ "Get the results for a specific test run ID in the default human-readable format; uses your default org:\n<%= config.bin %> <%= command.id %> --test-run-id <test-run-id>",
986
+ "Get the results for a specific test run ID, format them as JUnit, and save them to the \"test-results/junit\" directory; uses the org with alias \"my-scratch\":\n<%= config.bin %> <%= command.id %> --test-run-id <test-run-id> --result-format junit --target-org my-scratch"
987
987
  ],
988
988
  "flags": {
989
989
  "json": {
@@ -1115,6 +1115,7 @@
1115
1115
  "pluginAlias": "@salesforce/plugin-apex",
1116
1116
  "pluginName": "@salesforce/plugin-apex",
1117
1117
  "pluginType": "core",
1118
+ "state": "beta",
1118
1119
  "strict": true,
1119
1120
  "summary": "Get the results of a test run.",
1120
1121
  "enableJsonFlag": true,
@@ -1135,7 +1136,261 @@
1135
1136
  "test:logic:get",
1136
1137
  "test:get:logic"
1137
1138
  ]
1139
+ },
1140
+ "logic:run:test": {
1141
+ "aliases": [],
1142
+ "args": {},
1143
+ "description": "This command provides a single and unified way to run tests for multiple Salesforce features, such as Apex classes, Flows, and Agentforce agents. Running the tests together with a single command ensures seamless interoperability between the features.\n\nBy default, the command executes asynchronously and returns a test run ID. Then use the displayed \"sf logic get test\" command to retrieve the results. If you want to wait for the test run to complete and see the results in the command output, use the --synchronous flag.\n\nTo run specific tests, use the --tests flag and pass it the names of Apex, Flow, and Agentforce agent tests. Here's how to find the name of each type of test:\n\n- For Apex, simply specify the name of the Apex test class.\n- For Flows, use the format \"FlowTesting.<name-of-flow-test>\". To find the name of all the Flow tests in your org, run this command and specify the Flow category, such as \"sf logic run test --synchronous --test-category Flow --test-level RunAllTestsInOrg\". The command displays a table of all the Flow tests it ran; see the \"TEST NAME\" column for the full name of all available Flow tests in your org.\n- For Agentforce agents, use the format \"AgentTesting.<name-of-agent-test>\". To find the names of all the Agentforce agent tests in your org, run the \"sf agent test list\" command. The command displays the available agent tests in the \"API Name\" column.\n\nYou can also run specific test methods, although if you run the tests synchronously, the methods must belong to a single Apex class, Flow test, or Agentforce agent test. To run all tests of a certain category, use --test-category and --test-level together. If neither of these flags is specified, all local tests for all categories are run by default. You can also use the --class-names and --suite-names flags to run Apex test classes or suites.\n\nTo see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for the tested Apex classes, Flows, or Agentforce agents. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.\n\nYou must have the \"View All Data\" org system permission to use this command. The permission is disabled by default and can be enabled only by a system administrator.",
1144
+ "examples": [
1145
+ "Run a specific Agentforce agent test asynchronously in your default org:\n<%= config.bin %> <%= command.id %> --tests AgentTesting.Guest_Experience_Agent_Test",
1146
+ "Run a mix of specific Agentforce agent, Apex, and Flow tests asynchronously in your default org:\n<%= config.bin %> <%= command.id %> --tests AgentTesting.Guest_Experience_Agent_Test --tests MyApexClassTest --tests FlowTesting.Modify_Account_Desc.Modify_Account_Desc_TestAccountDescription",
1147
+ "Run all local Apex and Flow tests and wait for the results to complete; run the tests in the org with alias \"my-scratch\":\n<%= config.bin %> <%= command.id %> --test-level RunLocalTests --test-category Apex --test-category Flow --synchronous --target-org my-scratch",
1148
+ "Run two methods in an Apex test class and an Apex test suite:\n<%= config.bin %> <%= command.id %> --class-names MyApexClassTest.methodA --class-names MyApexClassTest.methodB --suite-names MySuite",
1149
+ "Run all local tests for all categories (the default behavior), save the JUnit results to the \"test-results\" directory, and include code coverage results:\n<%= config.bin %> <%= command.id %> --result-format junit --output-dir test-results --synchronous --code-coverage"
1150
+ ],
1151
+ "flags": {
1152
+ "json": {
1153
+ "description": "Format output as json.",
1154
+ "helpGroup": "GLOBAL",
1155
+ "name": "json",
1156
+ "allowNo": false,
1157
+ "type": "boolean"
1158
+ },
1159
+ "flags-dir": {
1160
+ "helpGroup": "GLOBAL",
1161
+ "name": "flags-dir",
1162
+ "summary": "Import flag values from a directory.",
1163
+ "hasDynamicHelp": false,
1164
+ "multiple": false,
1165
+ "type": "option"
1166
+ },
1167
+ "target-org": {
1168
+ "aliases": [
1169
+ "targetusername",
1170
+ "u"
1171
+ ],
1172
+ "char": "o",
1173
+ "deprecateAliases": true,
1174
+ "name": "target-org",
1175
+ "noCacheDefault": true,
1176
+ "required": true,
1177
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1178
+ "hasDynamicHelp": true,
1179
+ "multiple": false,
1180
+ "type": "option"
1181
+ },
1182
+ "api-version": {
1183
+ "aliases": [
1184
+ "apiversion"
1185
+ ],
1186
+ "deprecateAliases": true,
1187
+ "description": "Override the api version used for api requests made by this command",
1188
+ "name": "api-version",
1189
+ "hasDynamicHelp": false,
1190
+ "multiple": false,
1191
+ "type": "option"
1192
+ },
1193
+ "loglevel": {
1194
+ "deprecated": {
1195
+ "message": "The loglevel flag is no longer in use on this command. You may use it without error, but it will be ignored.\nSet the log level using the `SFDX_LOG_LEVEL` environment variable."
1196
+ },
1197
+ "hidden": true,
1198
+ "name": "loglevel",
1199
+ "hasDynamicHelp": false,
1200
+ "multiple": false,
1201
+ "type": "option"
1202
+ },
1203
+ "code-coverage": {
1204
+ "aliases": [
1205
+ "codecoverage"
1206
+ ],
1207
+ "char": "c",
1208
+ "deprecateAliases": true,
1209
+ "name": "code-coverage",
1210
+ "summary": "Retrieve code coverage results.",
1211
+ "allowNo": false,
1212
+ "type": "boolean"
1213
+ },
1214
+ "output-dir": {
1215
+ "aliases": [
1216
+ "outputdir",
1217
+ "output-directory"
1218
+ ],
1219
+ "char": "d",
1220
+ "deprecateAliases": true,
1221
+ "name": "output-dir",
1222
+ "summary": "Directory in which to store test run files.",
1223
+ "hasDynamicHelp": false,
1224
+ "multiple": false,
1225
+ "type": "option"
1226
+ },
1227
+ "test-level": {
1228
+ "aliases": [
1229
+ "testlevel"
1230
+ ],
1231
+ "char": "l",
1232
+ "deprecateAliases": true,
1233
+ "description": "Here's what the levels mean:\n\n- RunSpecifiedTests — Only the tests that you specify in the runTests option are run. Code coverage requirements differ from the default coverage requirements when using this test level. The executed tests must cover each class and trigger in the deployment package for a minimum of 75% code coverage. This coverage is computed for each class and triggers individually, and is different than the overall coverage percentage.\n- RunLocalTests — All local tests in your org, including tests that originate from no-namespaced unlocked packages, are run. The tests that originate from installed managed packages and namespaced unlocked packages aren't run. This test level is the default for production deployments that include Apex classes or triggers.\n- RunAllTestsInOrg — All tests are run. The tests include all tests in your org.",
1234
+ "name": "test-level",
1235
+ "summary": "Level of tests to run; default is RunLocalTests.",
1236
+ "hasDynamicHelp": false,
1237
+ "multiple": false,
1238
+ "options": [
1239
+ "RunLocalTests",
1240
+ "RunAllTestsInOrg",
1241
+ "RunSpecifiedTests"
1242
+ ],
1243
+ "type": "option"
1244
+ },
1245
+ "class-names": {
1246
+ "aliases": [
1247
+ "classnames"
1248
+ ],
1249
+ "char": "n",
1250
+ "deprecateAliases": true,
1251
+ "description": "If you select --class-names, you can't specify --suite-names or --tests.\nFor multiple classes, repeat the flag for each.\n--class-names Class1 --class-names Class2",
1252
+ "exclusive": [
1253
+ "suite-names",
1254
+ "tests",
1255
+ "test-category"
1256
+ ],
1257
+ "name": "class-names",
1258
+ "summary": "Apex test class names to run; default is all classes.",
1259
+ "delimiter": ",",
1260
+ "hasDynamicHelp": false,
1261
+ "multiple": true,
1262
+ "type": "option"
1263
+ },
1264
+ "result-format": {
1265
+ "aliases": [
1266
+ "resultformat"
1267
+ ],
1268
+ "char": "r",
1269
+ "deprecateAliases": true,
1270
+ "name": "result-format",
1271
+ "summary": "Format of the test results.",
1272
+ "default": "human",
1273
+ "hasDynamicHelp": false,
1274
+ "multiple": false,
1275
+ "options": [
1276
+ "human",
1277
+ "tap",
1278
+ "junit",
1279
+ "json"
1280
+ ],
1281
+ "type": "option"
1282
+ },
1283
+ "suite-names": {
1284
+ "aliases": [
1285
+ "suitenames"
1286
+ ],
1287
+ "char": "s",
1288
+ "deprecateAliases": true,
1289
+ "description": "If you select --suite-names, you can't specify --class-names or --tests.\nFor multiple suites, repeat the flag for each.\n--suite-names Suite1 --suite-names Suite2",
1290
+ "exclusive": [
1291
+ "class-names",
1292
+ "tests",
1293
+ "test-category"
1294
+ ],
1295
+ "name": "suite-names",
1296
+ "summary": "Apex test suite names to run.",
1297
+ "delimiter": ",",
1298
+ "hasDynamicHelp": false,
1299
+ "multiple": true,
1300
+ "type": "option"
1301
+ },
1302
+ "tests": {
1303
+ "char": "t",
1304
+ "description": "If you specify --tests, you can't specify --class-names or --suite-names\nFor multiple tests, repeat the flag for each.\n--tests Test1 --tests Test2",
1305
+ "exclusive": [
1306
+ "class-names",
1307
+ "suite-names",
1308
+ "test-category"
1309
+ ],
1310
+ "name": "tests",
1311
+ "summary": "List of test names to run. Can include Apex test classes, Flow tests, and Agentforce agent tests.",
1312
+ "delimiter": ",",
1313
+ "hasDynamicHelp": false,
1314
+ "multiple": true,
1315
+ "type": "option"
1316
+ },
1317
+ "wait": {
1318
+ "char": "w",
1319
+ "name": "wait",
1320
+ "summary": "Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently.",
1321
+ "hasDynamicHelp": true,
1322
+ "multiple": false,
1323
+ "type": "option"
1324
+ },
1325
+ "synchronous": {
1326
+ "char": "y",
1327
+ "name": "synchronous",
1328
+ "summary": "Runs test methods from a single Apex class synchronously; if not specified, tests are run asynchronously.",
1329
+ "allowNo": false,
1330
+ "type": "boolean"
1331
+ },
1332
+ "detailed-coverage": {
1333
+ "aliases": [
1334
+ "detailedcoverage"
1335
+ ],
1336
+ "char": "v",
1337
+ "dependsOn": [
1338
+ "code-coverage"
1339
+ ],
1340
+ "deprecateAliases": true,
1341
+ "name": "detailed-coverage",
1342
+ "summary": "Display detailed code coverage per test.",
1343
+ "allowNo": false,
1344
+ "type": "boolean"
1345
+ },
1346
+ "concise": {
1347
+ "name": "concise",
1348
+ "summary": "Display only failed test results; works with human-readable output only.",
1349
+ "allowNo": false,
1350
+ "type": "boolean"
1351
+ },
1352
+ "test-category": {
1353
+ "name": "test-category",
1354
+ "summary": "Category of tests to run, such as Agent, Apex, or Flow.",
1355
+ "delimiter": ",",
1356
+ "hasDynamicHelp": false,
1357
+ "multiple": true,
1358
+ "options": [
1359
+ "Agent",
1360
+ "Apex",
1361
+ "Flow"
1362
+ ],
1363
+ "type": "option"
1364
+ }
1365
+ },
1366
+ "hasDynamicHelp": true,
1367
+ "hiddenAliases": [],
1368
+ "id": "logic:run:test",
1369
+ "pluginAlias": "@salesforce/plugin-apex",
1370
+ "pluginName": "@salesforce/plugin-apex",
1371
+ "pluginType": "core",
1372
+ "state": "beta",
1373
+ "strict": true,
1374
+ "summary": "Invoke tests for Apex, Flows, and Agentforce agents in an org.",
1375
+ "enableJsonFlag": true,
1376
+ "isESM": true,
1377
+ "relativePath": [
1378
+ "lib",
1379
+ "commands",
1380
+ "logic",
1381
+ "run",
1382
+ "test.js"
1383
+ ],
1384
+ "aliasPermutations": [],
1385
+ "permutations": [
1386
+ "logic:run:test",
1387
+ "run:logic:test",
1388
+ "run:test:logic",
1389
+ "logic:test:run",
1390
+ "test:logic:run",
1391
+ "test:run:logic"
1392
+ ]
1138
1393
  }
1139
1394
  },
1140
- "version": "3.7.1"
1395
+ "version": "3.8.1-beta.1"
1141
1396
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-apex",
3
3
  "description": "Apex commands",
4
- "version": "3.7.1",
4
+ "version": "3.8.1-beta.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "dependencies": {
8
- "@salesforce/apex-node": "^8.3.2",
8
+ "@salesforce/apex-node": "8.3.4-dev.0",
9
9
  "@salesforce/core": "^8.10.1",
10
10
  "@salesforce/kit": "^3.2.3",
11
11
  "@salesforce/sf-plugins-core": "^12.2.1",
@@ -15,7 +15,7 @@
15
15
  "@oclif/core": "^4.2.10",
16
16
  "@oclif/plugin-command-snapshot": "^5.3.6",
17
17
  "@salesforce/cli-plugins-testkit": "^5.3.39",
18
- "@salesforce/dev-scripts": "^10.2.11",
18
+ "@salesforce/dev-scripts": "^11.0.4",
19
19
  "@salesforce/plugin-command-reference": "^3.1.52",
20
20
  "eslint-plugin-sf-plugin": "^1.20.24",
21
21
  "oclif": "^4.17.46",
@@ -42,7 +42,7 @@
42
42
  "sfdx",
43
43
  "sfdx-plugin"
44
44
  ],
45
- "license": "BSD-3-Clause",
45
+ "license": "Apache-2.0",
46
46
  "oclif": {
47
47
  "commands": "./lib/commands",
48
48
  "additionalHelpFlags": [
@@ -72,6 +72,9 @@
72
72
  "subtopics": {
73
73
  "get": {
74
74
  "description": "Get debug logs or test results."
75
+ },
76
+ "run": {
77
+ "description": "Run Apex and Flow tests."
75
78
  }
76
79
  }
77
80
  }
@@ -91,6 +94,7 @@
91
94
  "clean-all": "sf-clean all",
92
95
  "compile": "wireit",
93
96
  "docs": "sf-docs",
97
+ "fix-license": "eslint src test --fix --rule \"header/header: [2]\"",
94
98
  "format": "wireit",
95
99
  "link-check": "wireit",
96
100
  "lint": "wireit",
@@ -225,7 +229,7 @@
225
229
  "exports": "./lib/index.js",
226
230
  "type": "module",
227
231
  "sfdx": {
228
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.7.1.crt",
229
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.7.1.sig"
232
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.8.1-beta.1.crt",
233
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.8.1-beta.1.sig"
230
234
  }
231
235
  }