@salesforce/plugin-apex 3.7.0 → 3.8.0

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 (44) hide show
  1. package/LICENSE.txt +200 -6
  2. package/README.md +128 -8
  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/runlogictest.md +41 -0
  41. package/messages/runtest.md +2 -33
  42. package/messages/runtestcommon.md +40 -0
  43. package/oclif.manifest.json +255 -2
  44. package/package.json +11 -7
@@ -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",
@@ -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,259 @@
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 and Flows. 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 \"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, passing it the Apex test class names or the Flow tests in the form Flowtest.<name>. You can also run specific test methods, although if you run the tests synchronously, the methods must belong to a single Apex class or Flow test. To run all tests of a certain category, use --test-level with --test-category. If neither flag 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 classes or flows. 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 mix of specific Apex and Flow tests asynchronously in your default org:\n<%= config.bin %> <%= command.id %> --tests MyApexClassTest,FlowTest.ProcessOrder",
1146
+ "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",
1147
+ "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",
1148
+ "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"
1149
+ ],
1150
+ "flags": {
1151
+ "json": {
1152
+ "description": "Format output as json.",
1153
+ "helpGroup": "GLOBAL",
1154
+ "name": "json",
1155
+ "allowNo": false,
1156
+ "type": "boolean"
1157
+ },
1158
+ "flags-dir": {
1159
+ "helpGroup": "GLOBAL",
1160
+ "name": "flags-dir",
1161
+ "summary": "Import flag values from a directory.",
1162
+ "hasDynamicHelp": false,
1163
+ "multiple": false,
1164
+ "type": "option"
1165
+ },
1166
+ "target-org": {
1167
+ "aliases": [
1168
+ "targetusername",
1169
+ "u"
1170
+ ],
1171
+ "char": "o",
1172
+ "deprecateAliases": true,
1173
+ "name": "target-org",
1174
+ "noCacheDefault": true,
1175
+ "required": true,
1176
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1177
+ "hasDynamicHelp": true,
1178
+ "multiple": false,
1179
+ "type": "option"
1180
+ },
1181
+ "api-version": {
1182
+ "aliases": [
1183
+ "apiversion"
1184
+ ],
1185
+ "deprecateAliases": true,
1186
+ "description": "Override the api version used for api requests made by this command",
1187
+ "name": "api-version",
1188
+ "hasDynamicHelp": false,
1189
+ "multiple": false,
1190
+ "type": "option"
1191
+ },
1192
+ "loglevel": {
1193
+ "deprecated": {
1194
+ "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."
1195
+ },
1196
+ "hidden": true,
1197
+ "name": "loglevel",
1198
+ "hasDynamicHelp": false,
1199
+ "multiple": false,
1200
+ "type": "option"
1201
+ },
1202
+ "code-coverage": {
1203
+ "aliases": [
1204
+ "codecoverage"
1205
+ ],
1206
+ "char": "c",
1207
+ "deprecateAliases": true,
1208
+ "name": "code-coverage",
1209
+ "summary": "Retrieve code coverage results.",
1210
+ "allowNo": false,
1211
+ "type": "boolean"
1212
+ },
1213
+ "output-dir": {
1214
+ "aliases": [
1215
+ "outputdir",
1216
+ "output-directory"
1217
+ ],
1218
+ "char": "d",
1219
+ "deprecateAliases": true,
1220
+ "name": "output-dir",
1221
+ "summary": "Directory in which to store test run files.",
1222
+ "hasDynamicHelp": false,
1223
+ "multiple": false,
1224
+ "type": "option"
1225
+ },
1226
+ "test-level": {
1227
+ "aliases": [
1228
+ "testlevel"
1229
+ ],
1230
+ "char": "l",
1231
+ "deprecateAliases": true,
1232
+ "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.",
1233
+ "name": "test-level",
1234
+ "summary": "Level of tests to run; default is RunLocalTests.",
1235
+ "hasDynamicHelp": false,
1236
+ "multiple": false,
1237
+ "options": [
1238
+ "RunLocalTests",
1239
+ "RunAllTestsInOrg",
1240
+ "RunSpecifiedTests"
1241
+ ],
1242
+ "type": "option"
1243
+ },
1244
+ "class-names": {
1245
+ "aliases": [
1246
+ "classnames"
1247
+ ],
1248
+ "char": "n",
1249
+ "deprecateAliases": true,
1250
+ "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",
1251
+ "exclusive": [
1252
+ "suite-names",
1253
+ "tests",
1254
+ "test-category"
1255
+ ],
1256
+ "name": "class-names",
1257
+ "summary": "Apex test class names to run; default is all classes.",
1258
+ "delimiter": ",",
1259
+ "hasDynamicHelp": false,
1260
+ "multiple": true,
1261
+ "type": "option"
1262
+ },
1263
+ "result-format": {
1264
+ "aliases": [
1265
+ "resultformat"
1266
+ ],
1267
+ "char": "r",
1268
+ "deprecateAliases": true,
1269
+ "name": "result-format",
1270
+ "summary": "Format of the test results.",
1271
+ "default": "human",
1272
+ "hasDynamicHelp": false,
1273
+ "multiple": false,
1274
+ "options": [
1275
+ "human",
1276
+ "tap",
1277
+ "junit",
1278
+ "json"
1279
+ ],
1280
+ "type": "option"
1281
+ },
1282
+ "suite-names": {
1283
+ "aliases": [
1284
+ "suitenames"
1285
+ ],
1286
+ "char": "s",
1287
+ "deprecateAliases": true,
1288
+ "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",
1289
+ "exclusive": [
1290
+ "class-names",
1291
+ "tests",
1292
+ "test-category"
1293
+ ],
1294
+ "name": "suite-names",
1295
+ "summary": "Apex test suite names to run.",
1296
+ "delimiter": ",",
1297
+ "hasDynamicHelp": false,
1298
+ "multiple": true,
1299
+ "type": "option"
1300
+ },
1301
+ "tests": {
1302
+ "char": "t",
1303
+ "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",
1304
+ "exclusive": [
1305
+ "class-names",
1306
+ "suite-names",
1307
+ "test-category"
1308
+ ],
1309
+ "name": "tests",
1310
+ "summary": "Comma-separated list of test names to run. Can include Apex test classes and Flow tests.",
1311
+ "delimiter": ",",
1312
+ "hasDynamicHelp": false,
1313
+ "multiple": true,
1314
+ "type": "option"
1315
+ },
1316
+ "wait": {
1317
+ "char": "w",
1318
+ "name": "wait",
1319
+ "summary": "Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently.",
1320
+ "hasDynamicHelp": true,
1321
+ "multiple": false,
1322
+ "type": "option"
1323
+ },
1324
+ "synchronous": {
1325
+ "char": "y",
1326
+ "name": "synchronous",
1327
+ "summary": "Runs test methods from a single Apex class synchronously; if not specified, tests are run asynchronously.",
1328
+ "allowNo": false,
1329
+ "type": "boolean"
1330
+ },
1331
+ "detailed-coverage": {
1332
+ "aliases": [
1333
+ "detailedcoverage"
1334
+ ],
1335
+ "char": "v",
1336
+ "dependsOn": [
1337
+ "code-coverage"
1338
+ ],
1339
+ "deprecateAliases": true,
1340
+ "name": "detailed-coverage",
1341
+ "summary": "Display detailed code coverage per test.",
1342
+ "allowNo": false,
1343
+ "type": "boolean"
1344
+ },
1345
+ "concise": {
1346
+ "name": "concise",
1347
+ "summary": "Display only failed test results; works with human-readable output only.",
1348
+ "allowNo": false,
1349
+ "type": "boolean"
1350
+ },
1351
+ "test-category": {
1352
+ "name": "test-category",
1353
+ "summary": "Category of tests to run, such as Apex or Flow.",
1354
+ "delimiter": ",",
1355
+ "hasDynamicHelp": false,
1356
+ "multiple": true,
1357
+ "options": [
1358
+ "Apex",
1359
+ "Flow"
1360
+ ],
1361
+ "type": "option"
1362
+ }
1363
+ },
1364
+ "hasDynamicHelp": true,
1365
+ "hiddenAliases": [],
1366
+ "id": "logic:run:test",
1367
+ "pluginAlias": "@salesforce/plugin-apex",
1368
+ "pluginName": "@salesforce/plugin-apex",
1369
+ "pluginType": "core",
1370
+ "state": "beta",
1371
+ "strict": true,
1372
+ "summary": "Invoke tests for Apex and Flows in an org.",
1373
+ "enableJsonFlag": true,
1374
+ "isESM": true,
1375
+ "relativePath": [
1376
+ "lib",
1377
+ "commands",
1378
+ "logic",
1379
+ "run",
1380
+ "test.js"
1381
+ ],
1382
+ "aliasPermutations": [],
1383
+ "permutations": [
1384
+ "logic:run:test",
1385
+ "run:logic:test",
1386
+ "run:test:logic",
1387
+ "logic:test:run",
1388
+ "test:logic:run",
1389
+ "test:run:logic"
1390
+ ]
1138
1391
  }
1139
1392
  },
1140
- "version": "3.7.0"
1393
+ "version": "3.8.0"
1141
1394
  }
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.0",
4
+ "version": "3.8.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "dependencies": {
8
- "@salesforce/apex-node": "^8.3.1",
8
+ "@salesforce/apex-node": "^8.3.2",
9
9
  "@salesforce/core": "^8.10.1",
10
10
  "@salesforce/kit": "^3.2.3",
11
11
  "@salesforce/sf-plugins-core": "^12.2.1",
@@ -13,9 +13,9 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@oclif/core": "^4.2.10",
16
- "@oclif/plugin-command-snapshot": "^5.2.37",
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.0.crt",
229
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.7.0.sig"
232
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.8.0.crt",
233
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.8.0.sig"
230
234
  }
231
235
  }