55[ ![ Commitizen friendly] ( https://img.shields.io/badge/commitizen-friendly-brightgreen.svg )] ( http://commitizen.github.io/cz-cli/ )
66
77## Introduction
8- This is an oclif plugin that supports the Salesforce Apex commands. The plugin is bundled with the [ salesforcedx plugin] ( https://www.npmjs.com/package/salesforcedx ) .
8+
9+ This is an oclif plugin that supports the Salesforce Apex commands.
910
1011### Building the Plugin
1112
@@ -22,9 +23,11 @@ Ensure you have [Yarn](https://yarnpkg.com/) installed, then run:
2223$ yarn install
2324$ yarn build
2425```
26+
2527<br />
2628
2729### Linking the Plugin
30+
2831Link the plugin from the ` plugin-apex ` package directory and then run your command:
2932
3033```
@@ -37,6 +40,7 @@ Alternatively, you can also run the command from the `plugin-apex` package direc
3740```
3841$ NODE_OPTIONS=--inspect-brk bin/dev force:apex:log:list -u [email protected] 3942```
43+
4044<br />
4145### Running the Test Suite
4246
@@ -69,24 +73,29 @@ $ NODE_OPTIONS=--inspect-brk bin/dev force:apex:log:list -u
[email protected] 69733 . Click on the Debug icon in the Activity Bar to open up the Debugger view.
70744 . In the upper left hand corner, set the launch configuration to ` Attach to Remote ` .
71755 . Click the green play button on the left of the debugger view. The debugger should now be suspended on the first line of the program.
72- 6 . Click the green play button in the mini toolbar to continue running the program.
73- <br /><br />
74- <img src =" ./.images/vscodeScreenshot.png " width =" 480 " height =" 278 " >
76+ 6 . Click the green play button in the mini toolbar to continue running the program.
77+ <br /><br />
78+ <img src =" ./.images/vscodeScreenshot.png " width =" 480 " height =" 278 " >
7579
7680<br />
7781Happy debugging!
7882
7983<br /><br />
84+
8085# Commands
86+
8187<!-- commands -->
88+
8289The available commands in the Apex plugin:
8390<br /><br />
8491
8592### ` sfdx force:apex:log:get `
93+
8694fetch debug logs
95+
8796```
8897USAGE
89- $ sfdx force:apex:log:get [-i <id>] [-n <number>] [-d <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
98+ $ sfdx force:apex:log:get [-i <id>] [-n <number>] [-d <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
9099 trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
91100
92101OPTIONS
@@ -112,10 +121,10 @@ OPTIONS
112121 [default: warn] logging level for this command invocation
113122
114123DESCRIPTION
115- Fetches the specified log or given number of most recent logs from the scratch
116- org.
117- To get the IDs for your debug logs, run "sfdx force:apex:log:list".
118- Use the --logid parameter to return a specific log.
124+ Fetches the specified log or given number of most recent logs from the scratch
125+ org.
126+ To get the IDs for your debug logs, run "sfdx force:apex:log:list".
127+ Use the --logid parameter to return a specific log.
119128 Use the --number parameter to return the specified number of recent logs.
120129 Use the --outputdir parameter to specify the directory to store the logs in.
121130 Executing this command without parameters returns the most recent log.
@@ -126,14 +135,17 @@ EXAMPLES
126135 $ sfdx force:apex:log:get -n 2 -c
127136 $ sfdx force:apex:log:get -d Users/Desktop/logs -n 2
128137```
129- * See code: [ force/apex/log/get.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/get.ts ) *
138+
139+ _ See code: [ force/apex/log/get.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/get.ts ) _
130140<br /><br />
131141
132142### ` sfdx force:apex:log:list `
143+
133144display a list of IDs and general information about debug logs
145+
134146```
135147USAGE
136- $ sfdx force:apex:log:list [-u <string>] [--apiversion <string>] [--json] [--loglevel
148+ $ sfdx force:apex:log:list [-u <string>] [--apiversion <string>] [--json] [--loglevel
137149 trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
138150
139151OPTIONS
@@ -150,19 +162,21 @@ OPTIONS
150162 [default: warn] logging level for this command invocation
151163
152164DESCRIPTION
153- Run this command in a project to list the IDs and general information for all debug logs
165+ Run this command in a project to list the IDs and general information for all debug logs
154166 in your default org.
155- To fetch a specific log from your org, obtain the ID from this command's output, then run
167+ To fetch a specific log from your org, obtain the ID from this command's output, then run
156168 the “sfdx force:apex:log:get” command.
157169
158170EXAMPLES
159171 $ sfdx force:apex:log:list
160172 $ sfdx force:apex:log:list -u [email protected] 161173```
162- * See code: [ force/apex/log/list.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/list.ts ) *
174+
175+ _ See code: [ force/apex/log/list.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/list.ts ) _
163176<br /><br />
164177
165178### ` sfdx force:apex:log:tail `
179+
166180ensures logging is active and returns the logs to the running user
167181
168182```
@@ -201,14 +215,17 @@ EXAMPLES
201215 $ sfdx force:apex:log:tail --debuglevel MyDebugLevel
202216 $ sfdx force:apex:log:tail -c -s
203217```
204- * See code: [ force/apex/log/tail.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/tail.ts ) *
218+
219+ _ See code: [ force/apex/log/tail.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/log/tail.ts ) _
205220<br /><br />
206221
207222### ` sfdx force:apex:execute `
223+
208224executes anonymous Apex code
225+
209226```
210227USAGE
211- $ sfdx force:apex:execute [-f <filepath>] [-u <string>] [--apiversion <string>] [--json]
228+ $ sfdx force:apex:execute [-f <filepath>] [-u <string>] [--apiversion <string>] [--json]
212229 [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
213230
214231OPTIONS
@@ -228,31 +245,34 @@ OPTIONS
228245 [default: warn] logging level for this command invocation
229246
230247DESCRIPTION
231- Executes one or more lines of anonymous Apex code entered on the command line, or executes
248+ Executes one or more lines of anonymous Apex code entered on the command line, or executes
232249 the code in a local file.
233- If you don’t run this command from within a Salesforce DX project, —-targetusername is
250+ If you don’t run this command from within a Salesforce DX project, —-targetusername is
234251 required.
235- To execute your code interactively, run this command with no parameters. At the prompt,
236- enter all your Apex code; press CTRL-D when you're finished. Your code is then executed in
252+ To execute your code interactively, run this command with no parameters. At the prompt,
253+ enter all your Apex code; press CTRL-D when you're finished. Your code is then executed in
237254 a single execute anonymous request.
238255 For more information, see "Anonymous Blocks" in the Apex Developer Guide.
239256
240257EXAMPLES
241258 $ sfdx force:apex:execute -u [email protected] -f ~/test.apex 242259 $ sfdx force:apex:execute -f ~/test.apex
243- $ sfdx force:apex:execute
244- Start typing Apex code. Press the Enter key after each line, then press CTRL+D when
260+ $ sfdx force:apex:execute
261+ Start typing Apex code. Press the Enter key after each line, then press CTRL+D when
245262 finished.
246263```
247- * See code: [ force/apex/execute.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/execute.ts ) *
264+
265+ _ See code: [ force/apex/execute.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/execute.ts ) _
248266<br /><br />
249267
250268### ` sfdx force:apex:test:run `
269+
251270invoke Apex tests
271+
252272```
253273USAGE
254- $ sfdx force:apex:test:run [-d <string>] [-l RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests] [-n <string>] [-r human|tap|junit|json]
255- [-s <string>] [-t <string>] [-w <string>] [-y] [-v -c] [-u <string>] [--apiversion <string>] [--verbose] [--json]
274+ $ sfdx force:apex:test:run [-d <string>] [-l RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests] [-n <string>] [-r human|tap|junit|json]
275+ [-s <string>] [-t <string>] [-w <string>] [-y] [-v -c] [-u <string>] [--apiversion <string>] [--verbose] [--json]
256276 [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
257277
258278OPTIONS
@@ -265,23 +285,23 @@ OPTIONS
265285 -l, --testlevel=(RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests)
266286 specifies which tests to run, using one of these TestLevel enum values:
267287 RunSpecifiedTests—Only the tests that you specify are run.
268- RunLocalTests—All tests in your org are run, except the ones that originate from
288+ RunLocalTests—All tests in your org are run, except the ones that originate from
269289 installed managed packages.
270290 RunAllTestsInOrg—All tests are in your org and in installed managed packages are run
271291
272292 -n, --classnames=classnames
273- comma-separated list of Apex test class names to run; if you select --classnames, you
293+ comma-separated list of Apex test class names to run; if you select --classnames, you
274294 can't specify --suitenames or --tests
275295
276296 -r, --resultformat=(human|tap|junit|json)
277297 Permissible values are: human, tap, junit, json
278298
279299 -s, --suitenames=suitenames
280- comma-separated list of Apex test suite names to run; if you select --suitenames, you
300+ comma-separated list of Apex test suite names to run; if you select --suitenames, you
281301 can't specify --classnames or --tests
282302
283303 -t, --tests=tests
284- comma-separated list of Apex test class names or IDs and, if applicable, test methods to
304+ comma-separated list of Apex test class names or IDs and, if applicable, test methods to
285305 run; if you specify --tests, you can't specify --classnames or --suitenames
286306
287307 -u, --targetusername=targetusername
@@ -291,11 +311,11 @@ OPTIONS
291311 display detailed code coverage per test
292312
293313 -w, --wait=wait
294- sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur
314+ sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur
295315 frequently
296316
297317 -y, --synchronous
298- runs test methods from a single Apex class synchronously; if not specified, tests are
318+ runs test methods from a single Apex class synchronously; if not specified, tests are
299319 run ansynchronously
300320
301321 --apiversion=apiversion
@@ -305,44 +325,47 @@ OPTIONS
305325 format output as JSON
306326
307327 --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
308- [default: warn] [default: warn] logging level for this command invocation; logs are
328+ [default: warn] [default: warn] logging level for this command invocation; logs are
309329 stored in $HOME/.sfdx/sfdx.log
310330
311331 --verbose
312- display Apex test processing details; if JSON is specified, processing details aren't
332+ display Apex test processing details; if JSON is specified, processing details aren't
313333 displayed
314334
315335DESCRIPTION
316- Specify which tests to run by using the --classnames, --suites, or --tests parameters.
317- Alternatively, use the --testlevel parameter to run all the tests in your org, local
336+ Specify which tests to run by using the --classnames, --suites, or --tests parameters.
337+ Alternatively, use the --testlevel parameter to run all the tests in your org, local
318338 tests, or specified tests.
319- To see code coverage results, use the --codecoverage parameter with --resultformat. The
320- output displays a high-level summary of the test run and the code coverage values for
321- classes in your org. If you specify human-readable result format, use the
339+ To see code coverage results, use the --codecoverage parameter with --resultformat. The
340+ output displays a high-level summary of the test run and the code coverage values for
341+ classes in your org. If you specify human-readable result format, use the
322342 --detailedcoverage parameter to see detailed coverage results for each test method run.
323343 If --codecoverage is not included, code coverage will be skipped during the test run.
324344
325- NOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the
326- covered lines and total lines from all the Apex classes evaluated by the tests in this
345+ NOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the
346+ covered lines and total lines from all the Apex classes evaluated by the tests in this
327347 run.
328348
329349EXAMPLES
330350 $ sfdx force:apex:test:run
331351 $ sfdx force:apex:test:run -n "MyClassTest,MyOtherClassTest" -r human
332352 $ sfdx force:apex:test:run -s "MySuite,MyOtherSuite" -c -v --json
333- $ sfdx force:apex:test:run -t
353+ $ sfdx force:apex:test:run -t
334354 "MyClassTest.testCoolFeature,MyClassTest.testAwesomeFeature,AnotherClassTest,namespace.TheirClassTest.testThis" -r human
335355 $ sfdx force:apex:test:run -l RunLocalTests -d <path to outputdir> -u [email protected] 336356```
337- * See code: [ force/apex/test/run.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/test/run.ts ) *
357+
358+ _ See code: [ force/apex/test/run.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/test/run.ts ) _
338359<br /><br />
339360
340361### ` sfdx force:apex:test:report `
362+
341363display test results for a specific asynchronous test run
364+
342365```
343366USAGE
344367 $ sfdx force:apex:test:report -i <string> [-c] [-d <string>] [-r human|tap|junit|json] [-w <string>]
345- [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel
368+ [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel
346369 trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
347370
348371OPTIONS
@@ -362,7 +385,7 @@ OPTIONS
362385 username or alias for the target org; overrides default target org
363386
364387 -w, --wait=wait
365- sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur
388+ sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur
366389 frequently
367390
368391 --apiversion=apiversion
@@ -372,16 +395,16 @@ OPTIONS
372395 format output as JSON
373396
374397 --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
375- [default: warn] [default: warn] logging level for this command invocation; logs are
398+ [default: warn] [default: warn] logging level for this command invocation; logs are
376399 stored in $HOME/.sfdx/sfdx.log
377400
378401 --verbose
379- display Apex test processing details; if JSON is specified, processing details aren't
402+ display Apex test processing details; if JSON is specified, processing details aren't
380403 displayed
381404
382405DESCRIPTION
383- Provide a test run ID to display test results for an enqueued or completed asynchronous
384- test run. The test run ID is displayed after running the "sfdx force:apex:test:run"
406+ Provide a test run ID to display test results for an enqueued or completed asynchronous
407+ test run. The test run ID is displayed after running the "sfdx force:apex:test:run"
385408 command.
386409
387410EXAMPLES
@@ -390,5 +413,7 @@ EXAMPLES
390413 $ sfdx force:apex:test:report -i <test run id> -c --json
391414 $ sfdx force:apex:test:report -i <test run id> -c -d <path to outputdir> -u me@myorg
392415```
393- * See code: [ force/apex/test/report.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/test/report.ts ) *
394- <!-- commandsstop -->
416+
417+ _ See code: [ force/apex/test/report.ts] ( https://github.com/forcedotcom/salesforcedx-apex/blob/develop/packages/plugin-apex/src/commands/force/apex/test/report.ts ) _
418+
419+ <!-- commandsstop -->
0 commit comments