@salesforce/plugin-apex 2.3.20 → 3.0.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.
- package/README.md +55 -55
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +8 -0
- package/bin/run.js +9 -0
- package/lib/commands/apex/get/log.d.ts +6 -6
- package/lib/commands/apex/get/log.js +45 -46
- package/lib/commands/apex/get/log.js.map +1 -1
- package/lib/commands/apex/get/test.d.ts +8 -8
- package/lib/commands/apex/get/test.js +51 -52
- package/lib/commands/apex/get/test.js.map +1 -1
- package/lib/commands/apex/list/log.d.ts +3 -3
- package/lib/commands/apex/list/log.js +19 -20
- package/lib/commands/apex/list/log.js.map +1 -1
- package/lib/commands/apex/run/test.d.ts +14 -14
- package/lib/commands/apex/run/test.js +99 -102
- package/lib/commands/apex/run/test.js.map +1 -1
- package/lib/commands/apex/run.d.ts +4 -4
- package/lib/commands/apex/run.js +30 -31
- package/lib/commands/apex/run.js.map +1 -1
- package/lib/commands/apex/tail/log.d.ts +6 -6
- package/lib/commands/apex/tail/log.js +39 -39
- package/lib/commands/apex/tail/log.js.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/legacyColorization.js +9 -11
- package/lib/legacyColorization.js.map +1 -1
- package/lib/reporters/index.d.ts +2 -2
- package/lib/reporters/index.js +2 -7
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/jsonReporter.d.ts +1 -1
- package/lib/reporters/jsonReporter.js +1 -5
- package/lib/reporters/jsonReporter.js.map +1 -1
- package/lib/reporters/runReporter.d.ts +1 -1
- package/lib/reporters/runReporter.js +11 -12
- package/lib/reporters/runReporter.js.map +1 -1
- package/lib/reporters/testReporter.d.ts +1 -1
- package/lib/reporters/testReporter.js +28 -27
- package/lib/reporters/testReporter.js.map +1 -1
- package/lib/utils.d.ts +2 -3
- package/lib/utils.js +6 -10
- package/lib/utils.js.map +1 -1
- package/oclif.lock +7667 -0
- package/oclif.manifest.json +594 -325
- package/package.json +38 -57
- package/bin/dev +0 -21
- package/bin/run +0 -5
package/README.md
CHANGED
|
@@ -87,20 +87,20 @@ Happy debugging!
|
|
|
87
87
|
|
|
88
88
|
<!-- commands -->
|
|
89
89
|
|
|
90
|
-
- [`
|
|
91
|
-
- [`
|
|
92
|
-
- [`
|
|
93
|
-
- [`
|
|
94
|
-
- [`
|
|
95
|
-
- [`
|
|
90
|
+
- [`sf apex get log`](#sf-apex-get-log)
|
|
91
|
+
- [`sf apex get test`](#sf-apex-get-test)
|
|
92
|
+
- [`sf apex list log`](#sf-apex-list-log)
|
|
93
|
+
- [`sf apex run`](#sf-apex-run)
|
|
94
|
+
- [`sf apex run test`](#sf-apex-run-test)
|
|
95
|
+
- [`sf apex tail log`](#sf-apex-tail-log)
|
|
96
96
|
|
|
97
|
-
## `
|
|
97
|
+
## `sf apex get log`
|
|
98
98
|
|
|
99
99
|
Fetch the specified log or given number of most recent logs from the org.
|
|
100
100
|
|
|
101
101
|
```
|
|
102
102
|
USAGE
|
|
103
|
-
$
|
|
103
|
+
$ sf apex get log -o <value> [--json] [--api-version <value>] [-i <value>] [-n <value>] [-d <value>]
|
|
104
104
|
|
|
105
105
|
FLAGS
|
|
106
106
|
-d, --output-dir=<value> Directory for saving the log files.
|
|
@@ -115,28 +115,28 @@ GLOBAL FLAGS
|
|
|
115
115
|
DESCRIPTION
|
|
116
116
|
Fetch the specified log or given number of most recent logs from the org.
|
|
117
117
|
|
|
118
|
-
To get the IDs for your debug logs, run "
|
|
118
|
+
To get the IDs for your debug logs, run "sf apex log list". Executing this command without flags returns the most
|
|
119
119
|
recent log.
|
|
120
120
|
|
|
121
121
|
ALIASES
|
|
122
|
-
$
|
|
122
|
+
$ sf force apex log get
|
|
123
123
|
|
|
124
124
|
EXAMPLES
|
|
125
125
|
Fetch the log in your default org using an ID:
|
|
126
126
|
|
|
127
|
-
$
|
|
127
|
+
$ sf apex get log --log-id <log id>
|
|
128
128
|
|
|
129
129
|
Fetch the log in the org with the specified username using an ID:
|
|
130
130
|
|
|
131
|
-
$
|
|
131
|
+
$ sf apex get log --log-id <log id> --target-org me@my.org
|
|
132
132
|
|
|
133
133
|
Fetch the two most recent logs in your default org:
|
|
134
134
|
|
|
135
|
-
$
|
|
135
|
+
$ sf apex get log --number 2
|
|
136
136
|
|
|
137
137
|
Similar to previous example, but save the two log files in the specified directory:
|
|
138
138
|
|
|
139
|
-
$
|
|
139
|
+
$ sf apex get log --output-dir /Users/sfdxUser/logs --number 2
|
|
140
140
|
|
|
141
141
|
FLAG DESCRIPTIONS
|
|
142
142
|
-d, --output-dir=<value> Directory for saving the log files.
|
|
@@ -145,15 +145,15 @@ FLAG DESCRIPTIONS
|
|
|
145
145
|
directory.
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
_See code: [src/commands/apex/get/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
148
|
+
_See code: [src/commands/apex/get/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/get/log.ts)_
|
|
149
149
|
|
|
150
|
-
## `
|
|
150
|
+
## `sf apex get test`
|
|
151
151
|
|
|
152
152
|
Display test results for a specific asynchronous test run.
|
|
153
153
|
|
|
154
154
|
```
|
|
155
155
|
USAGE
|
|
156
|
-
$
|
|
156
|
+
$ sf apex get test -o <value> -i <value> [--json] [--api-version <value>] [-c] [-d <value>] [-r
|
|
157
157
|
human|tap|junit|json]
|
|
158
158
|
|
|
159
159
|
FLAGS
|
|
@@ -172,40 +172,40 @@ DESCRIPTION
|
|
|
172
172
|
Display test results for a specific asynchronous test run.
|
|
173
173
|
|
|
174
174
|
Provide a test run ID to display test results for an enqueued or completed asynchronous test run. The test run ID is
|
|
175
|
-
displayed after running the "
|
|
175
|
+
displayed after running the "sf apex test run" command.
|
|
176
176
|
|
|
177
177
|
ALIASES
|
|
178
|
-
$
|
|
178
|
+
$ sf force apex test report
|
|
179
179
|
|
|
180
180
|
EXAMPLES
|
|
181
181
|
Display test results for your default org using a test run ID:
|
|
182
182
|
|
|
183
|
-
$
|
|
183
|
+
$ sf apex get test --test-run-id <test run id>
|
|
184
184
|
|
|
185
185
|
Similar to previous example, but output the result in JUnit format:
|
|
186
186
|
|
|
187
|
-
$
|
|
187
|
+
$ sf apex get test --test-run-id <test run id> --result-format junit
|
|
188
188
|
|
|
189
189
|
Also retrieve code coverage results and output in JSON format:
|
|
190
190
|
|
|
191
|
-
$
|
|
191
|
+
$ sf apex get test --test-run-id <test run id> --code-coverage --json
|
|
192
192
|
|
|
193
193
|
Specify a directory in which to save the test results from the org with the specified username (rather than your
|
|
194
194
|
default org):
|
|
195
195
|
|
|
196
|
-
$
|
|
196
|
+
$ sf apex get test --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org \
|
|
197
197
|
me@myorg',
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
_See code: [src/commands/apex/get/test.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
200
|
+
_See code: [src/commands/apex/get/test.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/get/test.ts)_
|
|
201
201
|
|
|
202
|
-
## `
|
|
202
|
+
## `sf apex list log`
|
|
203
203
|
|
|
204
204
|
Display a list of IDs and general information about debug logs.
|
|
205
205
|
|
|
206
206
|
```
|
|
207
207
|
USAGE
|
|
208
|
-
$
|
|
208
|
+
$ sf apex list log -o <value> [--json] [--api-version <value>]
|
|
209
209
|
|
|
210
210
|
FLAGS
|
|
211
211
|
-o, --target-org=<value> (required) Username or alias of the target org.
|
|
@@ -219,31 +219,31 @@ DESCRIPTION
|
|
|
219
219
|
|
|
220
220
|
Run this command in a project to list the IDs and general information for all debug logs in your default org.
|
|
221
221
|
|
|
222
|
-
To fetch a specific log from your org, obtain the ID from this command's output, then run the “
|
|
222
|
+
To fetch a specific log from your org, obtain the ID from this command's output, then run the “sf apex log get”
|
|
223
223
|
command.
|
|
224
224
|
|
|
225
225
|
ALIASES
|
|
226
|
-
$
|
|
226
|
+
$ sf force apex log list
|
|
227
227
|
|
|
228
228
|
EXAMPLES
|
|
229
229
|
List the IDs and information about the debug logs in your default org:
|
|
230
230
|
|
|
231
|
-
$
|
|
231
|
+
$ sf apex list log
|
|
232
232
|
|
|
233
233
|
Similar to previous example, but use the org with the specified username:
|
|
234
234
|
|
|
235
|
-
$
|
|
235
|
+
$ sf apex list log --target-org me@my.org
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
_See code: [src/commands/apex/list/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
238
|
+
_See code: [src/commands/apex/list/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/list/log.ts)_
|
|
239
239
|
|
|
240
|
-
## `
|
|
240
|
+
## `sf apex run`
|
|
241
241
|
|
|
242
242
|
Execute anonymous Apex code entered on the command line or from a local file.
|
|
243
243
|
|
|
244
244
|
```
|
|
245
245
|
USAGE
|
|
246
|
-
$
|
|
246
|
+
$ sf apex run -o <value> [--json] [--api-version <value>] [-f <value>]
|
|
247
247
|
|
|
248
248
|
FLAGS
|
|
249
249
|
-f, --file=<value> Path to a local file that contains Apex code.
|
|
@@ -263,32 +263,32 @@ DESCRIPTION
|
|
|
263
263
|
For more information, see "Anonymous Blocks" in the Apex Developer Guide.
|
|
264
264
|
|
|
265
265
|
ALIASES
|
|
266
|
-
$
|
|
266
|
+
$ sf force apex execute
|
|
267
267
|
|
|
268
268
|
EXAMPLES
|
|
269
269
|
Execute the Apex code that's in the ~/test.apex file in the org with the specified username:
|
|
270
270
|
|
|
271
|
-
$
|
|
271
|
+
$ sf apex run --target-org testusername@salesforce.org --file ~/test.apex
|
|
272
272
|
|
|
273
273
|
Similar to previous example, but execute the code in your default org:
|
|
274
274
|
|
|
275
|
-
$
|
|
275
|
+
$ sf apex run --file ~/test.apex
|
|
276
276
|
|
|
277
277
|
Run the command with no flags to start interactive mode; the code will execute in your default org when you exit. At
|
|
278
278
|
the prompt, start type Apex code and press the Enter key after each line. Press CTRL+D when finished.
|
|
279
279
|
|
|
280
|
-
$
|
|
280
|
+
$ sf apex run
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
-
_See code: [src/commands/apex/run.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
283
|
+
_See code: [src/commands/apex/run.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/run.ts)_
|
|
284
284
|
|
|
285
|
-
## `
|
|
285
|
+
## `sf apex run test`
|
|
286
286
|
|
|
287
287
|
Invoke Apex tests in an org.
|
|
288
288
|
|
|
289
289
|
```
|
|
290
290
|
USAGE
|
|
291
|
-
$
|
|
291
|
+
$ sf apex run test -o <value> [--json] [--api-version <value>] [-d <value>] [-l
|
|
292
292
|
RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests] [-n <value> | -s <value> | -t <value>] [-r human|tap|junit|json]
|
|
293
293
|
[-w <value>] [-y] [-v -c]
|
|
294
294
|
|
|
@@ -326,37 +326,37 @@ DESCRIPTION
|
|
|
326
326
|
|
|
327
327
|
By default, Apex tests run asynchronously and immediately return a test run ID. You can use the --wait flag to specify
|
|
328
328
|
the number of minutes to wait; if the tests finish in that timeframe, the command displays the results. If the tests
|
|
329
|
-
haven't finished by the end of the wait time, the command displays a test run ID. Use the "
|
|
329
|
+
haven't finished by the end of the wait time, the command displays a test run ID. Use the "sf apex get test
|
|
330
330
|
--test-run-id" command to get the results.
|
|
331
331
|
|
|
332
332
|
NOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the covered lines and total lines
|
|
333
333
|
from all the Apex classes evaluated by the tests in this run.
|
|
334
334
|
|
|
335
335
|
ALIASES
|
|
336
|
-
$
|
|
336
|
+
$ sf force apex test run
|
|
337
337
|
|
|
338
338
|
EXAMPLES
|
|
339
339
|
Run all Apex tests and suites in your default org:
|
|
340
340
|
|
|
341
|
-
$
|
|
341
|
+
$ sf apex run test
|
|
342
342
|
|
|
343
343
|
Run the specified Apex test classes in your default org and display results in human-readable form:
|
|
344
344
|
|
|
345
|
-
$
|
|
345
|
+
$ sf apex run test --class-names MyClassTest --class-names MyOtherClassTest --result-format human
|
|
346
346
|
|
|
347
347
|
Run the specified Apex test suites in your default org and include code coverage results and additional details:
|
|
348
348
|
|
|
349
|
-
$
|
|
349
|
+
$ sf apex run test --suite-names MySuite --suite-names MyOtherSuite --code-coverage --detailed-coverage
|
|
350
350
|
|
|
351
351
|
Run the specified Apex tests in your default org and display results in human-readable output:
|
|
352
352
|
|
|
353
|
-
$
|
|
353
|
+
$ sf apex run test --tests MyClassTest.testCoolFeature --tests MyClassTest.testAwesomeFeature --tests \
|
|
354
354
|
AnotherClassTest --tests namespace.TheirClassTest.testThis --result-format human
|
|
355
355
|
|
|
356
356
|
Run all tests in the org with the specified username with the specified test level; save the output to the specified
|
|
357
357
|
directory:
|
|
358
358
|
|
|
359
|
-
$
|
|
359
|
+
$ sf apex run test --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org
|
|
360
360
|
|
|
361
361
|
FLAG DESCRIPTIONS
|
|
362
362
|
-l, --test-level=RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests Level of tests to run; default is RunLocalTests.
|
|
@@ -386,15 +386,15 @@ FLAG DESCRIPTIONS
|
|
|
386
386
|
--tests Test1 --tests Test2
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
_See code: [src/commands/apex/run/test.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
389
|
+
_See code: [src/commands/apex/run/test.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/run/test.ts)_
|
|
390
390
|
|
|
391
|
-
## `
|
|
391
|
+
## `sf apex tail log`
|
|
392
392
|
|
|
393
393
|
Activate debug logging and display logs in the terminal.
|
|
394
394
|
|
|
395
395
|
```
|
|
396
396
|
USAGE
|
|
397
|
-
$
|
|
397
|
+
$ sf apex tail log -o <value> [--json] [--api-version <value>] [-c] [-d <value> | -s]
|
|
398
398
|
|
|
399
399
|
FLAGS
|
|
400
400
|
-c, --color Apply default colors to noteworthy log lines.
|
|
@@ -412,22 +412,22 @@ DESCRIPTION
|
|
|
412
412
|
You can also pipe the logs to a file.
|
|
413
413
|
|
|
414
414
|
ALIASES
|
|
415
|
-
$
|
|
415
|
+
$ sf force apex log tail
|
|
416
416
|
|
|
417
417
|
EXAMPLES
|
|
418
418
|
Activate debug logging:
|
|
419
419
|
|
|
420
|
-
$
|
|
420
|
+
$ sf apex tail log
|
|
421
421
|
|
|
422
422
|
Specify a debug level:
|
|
423
423
|
|
|
424
|
-
$
|
|
424
|
+
$ sf apex tail log --debug-level MyDebugLevel
|
|
425
425
|
|
|
426
426
|
Skip the trace flag setup and apply default colors:
|
|
427
427
|
|
|
428
|
-
$
|
|
428
|
+
$ sf apex tail log --color --skip-trace-flag
|
|
429
429
|
```
|
|
430
430
|
|
|
431
|
-
_See code: [src/commands/apex/tail/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.
|
|
431
|
+
_See code: [src/commands/apex/tail/log.ts](https://github.com/salesforcecli/plugin-apex/blob/2.3.21/src/commands/apex/tail/log.ts)_
|
|
432
432
|
|
|
433
433
|
<!-- commandsstop -->
|
package/bin/dev.cmd
CHANGED
package/bin/dev.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
|
|
2
|
+
// eslint-disable-next-line node/shebang
|
|
3
|
+
async function main() {
|
|
4
|
+
const { execute } = await import('@oclif/core');
|
|
5
|
+
await execute({ development: true, dir: import.meta.url });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
await main();
|
package/bin/run.js
ADDED
|
@@ -9,12 +9,12 @@ export default class Log extends SfCommand<LogGetResult> {
|
|
|
9
9
|
static readonly deprecateAliases = true;
|
|
10
10
|
static readonly aliases: string[];
|
|
11
11
|
static readonly flags: {
|
|
12
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
-
'log-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
-
number: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
-
'output-dir': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
|
+
'log-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
|
+
number: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
|
+
'output-dir': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
18
|
};
|
|
19
19
|
run(): Promise<LogGetResult>;
|
|
20
20
|
}
|
|
@@ -1,22 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { LogService } from '@salesforce/apex-node';
|
|
10
|
+
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages } from '@salesforce/core';
|
|
12
|
+
import { colorLogs } from '../../../utils.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'get');
|
|
15
|
+
export default class Log extends SfCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
19
|
+
static deprecateAliases = true;
|
|
20
|
+
static aliases = ['force:apex:log:get'];
|
|
21
|
+
static flags = {
|
|
22
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
23
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
24
|
+
loglevel,
|
|
25
|
+
'log-id': Flags.salesforceId({
|
|
26
|
+
deprecateAliases: true,
|
|
27
|
+
aliases: ['logid'],
|
|
28
|
+
char: 'i',
|
|
29
|
+
summary: messages.getMessage('flags.log-id.summary'),
|
|
30
|
+
startsWith: '07L',
|
|
31
|
+
length: 'both',
|
|
32
|
+
}),
|
|
33
|
+
// Removed default because it will take priority over 'log-id' in the apex library
|
|
34
|
+
// https://github.com/forcedotcom/salesforcedx-apex/blob/main/src/logs/logService.ts#L57-L60
|
|
35
|
+
// eslint-disable-next-line sf-plugin/flag-min-max-default
|
|
36
|
+
number: Flags.integer({
|
|
37
|
+
char: 'n',
|
|
38
|
+
min: 1,
|
|
39
|
+
max: 25,
|
|
40
|
+
summary: messages.getMessage('flags.number.summary'),
|
|
41
|
+
}),
|
|
42
|
+
'output-dir': Flags.directory({
|
|
43
|
+
aliases: ['outputdir', 'output-directory'],
|
|
44
|
+
deprecateAliases: true,
|
|
45
|
+
char: 'd',
|
|
46
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
47
|
+
description: messages.getMessage('flags.output-dir.description'),
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
16
50
|
async run() {
|
|
17
51
|
const { flags } = await this.parse(Log);
|
|
18
52
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
19
|
-
const logService = new
|
|
53
|
+
const logService = new LogService(conn);
|
|
20
54
|
const logResults = await logService.getLogs({
|
|
21
55
|
logId: flags['log-id'],
|
|
22
56
|
numberOfLogs: flags.number,
|
|
@@ -32,44 +66,9 @@ class Log extends sf_plugins_core_1.SfCommand {
|
|
|
32
66
|
return logResults.map((logResult) => logResult.log);
|
|
33
67
|
}
|
|
34
68
|
return logResults.map((logResult) => {
|
|
35
|
-
this.log(
|
|
69
|
+
this.log(colorLogs(logResult.log));
|
|
36
70
|
return { log: logResult.log };
|
|
37
71
|
});
|
|
38
72
|
}
|
|
39
73
|
}
|
|
40
|
-
exports.default = Log;
|
|
41
|
-
Log.summary = messages.getMessage('summary');
|
|
42
|
-
Log.description = messages.getMessage('description');
|
|
43
|
-
Log.examples = messages.getMessages('examples');
|
|
44
|
-
Log.deprecateAliases = true;
|
|
45
|
-
Log.aliases = ['force:apex:log:get'];
|
|
46
|
-
Log.flags = {
|
|
47
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
48
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
49
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
50
|
-
'log-id': sf_plugins_core_1.Flags.salesforceId({
|
|
51
|
-
deprecateAliases: true,
|
|
52
|
-
aliases: ['logid'],
|
|
53
|
-
char: 'i',
|
|
54
|
-
summary: messages.getMessage('flags.log-id.summary'),
|
|
55
|
-
startsWith: '07L',
|
|
56
|
-
length: 'both',
|
|
57
|
-
}),
|
|
58
|
-
// Removed default because it will take priority over 'log-id' in the apex library
|
|
59
|
-
// https://github.com/forcedotcom/salesforcedx-apex/blob/main/src/logs/logService.ts#L57-L60
|
|
60
|
-
// eslint-disable-next-line sf-plugin/flag-min-max-default
|
|
61
|
-
number: sf_plugins_core_1.Flags.integer({
|
|
62
|
-
char: 'n',
|
|
63
|
-
min: 1,
|
|
64
|
-
max: 25,
|
|
65
|
-
summary: messages.getMessage('flags.number.summary'),
|
|
66
|
-
}),
|
|
67
|
-
'output-dir': sf_plugins_core_1.Flags.directory({
|
|
68
|
-
aliases: ['outputdir', 'output-directory'],
|
|
69
|
-
deprecateAliases: true,
|
|
70
|
-
char: 'd',
|
|
71
|
-
summary: messages.getMessage('flags.output-dir.summary'),
|
|
72
|
-
description: messages.getMessage('flags.output-dir.description'),
|
|
73
|
-
}),
|
|
74
|
-
};
|
|
75
74
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,EAC/B,SAAS,GACV,MAAM,6BAA6B,CAAC;A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AAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YACnC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { RunResult } from '../../../reporters';
|
|
2
|
+
import { RunResult } from '../../../reporters/index.js';
|
|
3
3
|
export default class Test extends SfCommand<RunResult> {
|
|
4
4
|
static readonly summary: string;
|
|
5
5
|
static readonly description: string;
|
|
@@ -7,13 +7,13 @@ export default class Test extends SfCommand<RunResult> {
|
|
|
7
7
|
static readonly deprecateAliases = true;
|
|
8
8
|
static readonly aliases: string[];
|
|
9
9
|
static readonly flags: {
|
|
10
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
-
'test-run-id': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
-
'code-coverage': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
'output-dir': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
-
'result-format': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
'test-run-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
'code-coverage': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
|
+
'output-dir': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
|
+
'result-format': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
17
|
};
|
|
18
18
|
run(): Promise<RunResult>;
|
|
19
19
|
}
|
|
@@ -1,19 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { TestService } from '@salesforce/apex-node';
|
|
10
|
+
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, Ux, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages } from '@salesforce/core';
|
|
12
|
+
import { TestReporter } from '../../../reporters/index.js';
|
|
13
|
+
import { resultFormat } from '../../../utils.js';
|
|
14
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
15
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'report');
|
|
16
|
+
export default class Test extends SfCommand {
|
|
17
|
+
static summary = messages.getMessage('summary');
|
|
18
|
+
static description = messages.getMessage('description');
|
|
19
|
+
static examples = messages.getMessages('examples');
|
|
20
|
+
static deprecateAliases = true;
|
|
21
|
+
static aliases = ['force:apex:test:report'];
|
|
22
|
+
static flags = {
|
|
23
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
24
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
25
|
+
loglevel,
|
|
26
|
+
'test-run-id': Flags.salesforceId({
|
|
27
|
+
deprecateAliases: true,
|
|
28
|
+
aliases: ['testrunid'],
|
|
29
|
+
char: 'i',
|
|
30
|
+
summary: messages.getMessage('flags.test-run-id.summary'),
|
|
31
|
+
required: true,
|
|
32
|
+
startsWith: '707',
|
|
33
|
+
length: 'both',
|
|
34
|
+
}),
|
|
35
|
+
'code-coverage': Flags.boolean({
|
|
36
|
+
aliases: ['codecoverage'],
|
|
37
|
+
deprecateAliases: true,
|
|
38
|
+
char: 'c',
|
|
39
|
+
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
40
|
+
}),
|
|
41
|
+
'output-dir': Flags.directory({
|
|
42
|
+
aliases: ['outputdir', 'output-directory'],
|
|
43
|
+
deprecateAliases: true,
|
|
44
|
+
char: 'd',
|
|
45
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
46
|
+
}),
|
|
47
|
+
'result-format': Flags.string({
|
|
48
|
+
deprecateAliases: true,
|
|
49
|
+
aliases: ['resultformat'],
|
|
50
|
+
char: 'r',
|
|
51
|
+
summary: messages.getMessage('flags.result-format.summary'),
|
|
52
|
+
options: resultFormat,
|
|
53
|
+
default: 'human',
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
17
56
|
async run() {
|
|
18
57
|
const { flags } = await this.parse(Test);
|
|
19
58
|
// add listener for errors
|
|
@@ -21,9 +60,9 @@ class Test extends sf_plugins_core_1.SfCommand {
|
|
|
21
60
|
throw messages.createError('apexLibErr', [err.message]);
|
|
22
61
|
});
|
|
23
62
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
24
|
-
const testService = new
|
|
63
|
+
const testService = new TestService(conn);
|
|
25
64
|
const result = await testService.reportAsyncResults(flags['test-run-id'], flags['code-coverage']);
|
|
26
|
-
const testReporter = new
|
|
65
|
+
const testReporter = new TestReporter(new Ux({ jsonEnabled: this.jsonEnabled() }), conn, this.config.bin);
|
|
27
66
|
return testReporter.report(result, {
|
|
28
67
|
'output-dir': flags['output-dir'],
|
|
29
68
|
'result-format': flags['result-format'],
|
|
@@ -32,44 +71,4 @@ class Test extends sf_plugins_core_1.SfCommand {
|
|
|
32
71
|
});
|
|
33
72
|
}
|
|
34
73
|
}
|
|
35
|
-
exports.default = Test;
|
|
36
|
-
Test.summary = messages.getMessage('summary');
|
|
37
|
-
Test.description = messages.getMessage('description');
|
|
38
|
-
Test.examples = messages.getMessages('examples');
|
|
39
|
-
Test.deprecateAliases = true;
|
|
40
|
-
Test.aliases = ['force:apex:test:report'];
|
|
41
|
-
Test.flags = {
|
|
42
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
43
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
44
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
45
|
-
'test-run-id': sf_plugins_core_1.Flags.salesforceId({
|
|
46
|
-
deprecateAliases: true,
|
|
47
|
-
aliases: ['testrunid'],
|
|
48
|
-
char: 'i',
|
|
49
|
-
summary: messages.getMessage('flags.test-run-id.summary'),
|
|
50
|
-
required: true,
|
|
51
|
-
startsWith: '707',
|
|
52
|
-
length: 'both',
|
|
53
|
-
}),
|
|
54
|
-
'code-coverage': sf_plugins_core_1.Flags.boolean({
|
|
55
|
-
aliases: ['codecoverage'],
|
|
56
|
-
deprecateAliases: true,
|
|
57
|
-
char: 'c',
|
|
58
|
-
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
59
|
-
}),
|
|
60
|
-
'output-dir': sf_plugins_core_1.Flags.directory({
|
|
61
|
-
aliases: ['outputdir', 'output-directory'],
|
|
62
|
-
deprecateAliases: true,
|
|
63
|
-
char: 'd',
|
|
64
|
-
summary: messages.getMessage('flags.output-dir.summary'),
|
|
65
|
-
}),
|
|
66
|
-
'result-format': sf_plugins_core_1.Flags.string({
|
|
67
|
-
deprecateAliases: true,
|
|
68
|
-
aliases: ['resultformat'],
|
|
69
|
-
char: 'r',
|
|
70
|
-
summary: messages.getMessage('flags.result-format.summary'),
|
|
71
|
-
options: utils_1.resultFormat,
|
|
72
|
-
default: 'human',
|
|
73
|
-
}),
|
|
74
|
-
};
|
|
75
74
|
//# sourceMappingURL=test.js.map
|