@salesforce/plugin-apex 3.1.22 → 3.2.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 +42 -11
- package/lib/commands/apex/get/log.js +1 -1
- package/lib/commands/apex/get/log.js.map +1 -1
- package/lib/commands/apex/get/test.js +3 -15
- package/lib/commands/apex/get/test.js.map +1 -1
- package/lib/commands/apex/list/log.d.ts +1 -1
- package/lib/commands/apex/list/log.js +25 -38
- package/lib/commands/apex/list/log.js.map +1 -1
- package/lib/commands/apex/run/test.js +3 -15
- package/lib/commands/apex/run/test.js.map +1 -1
- package/lib/commands/apex/tail/log.js +4 -3
- package/lib/commands/apex/tail/log.js.map +1 -1
- package/lib/flags.d.ts +2 -0
- package/lib/flags.js +25 -0
- package/lib/flags.js.map +1 -0
- package/lib/logColorize.d.ts +5 -0
- package/lib/logColorize.js +42 -0
- package/lib/logColorize.js.map +1 -0
- package/lib/reporters/runReporter.js +4 -4
- package/lib/reporters/runReporter.js.map +1 -1
- package/lib/reporters/testReporter.js +1 -1
- package/lib/reporters/testReporter.js.map +1 -1
- package/messages/flags.md +7 -0
- package/messages/gettest.md +2 -9
- package/messages/list.md +0 -40
- package/messages/runtest.md +26 -5
- package/oclif.manifest.json +127 -121
- package/package.json +9 -12
- package/lib/legacyColorization.d.ts +0 -6
- package/lib/legacyColorization.js +0 -66
- package/lib/legacyColorization.js.map +0 -1
- package/lib/utils.d.ts +0 -5
- package/lib/utils.js +0 -35
- package/lib/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ FLAG DESCRIPTIONS
|
|
|
148
148
|
directory.
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
_See code: [src/commands/apex/get/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
151
|
+
_See code: [src/commands/apex/get/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/get/log.ts)_
|
|
152
152
|
|
|
153
153
|
## `sf apex get test`
|
|
154
154
|
|
|
@@ -165,7 +165,7 @@ FLAGS
|
|
|
165
165
|
-i, --test-run-id=<value> (required) ID of the test run.
|
|
166
166
|
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
167
167
|
configuration variable is already set.
|
|
168
|
-
-r, --result-format=<option> [default: human] Format of the results.
|
|
168
|
+
-r, --result-format=<option> [default: human] Format of the test results.
|
|
169
169
|
<options: human|tap|junit|json>
|
|
170
170
|
--api-version=<value> Override the api version used for api requests made by this command
|
|
171
171
|
|
|
@@ -199,10 +199,10 @@ EXAMPLES
|
|
|
199
199
|
default org):
|
|
200
200
|
|
|
201
201
|
$ sf apex get test --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org \
|
|
202
|
-
me@myorg'
|
|
202
|
+
me@myorg'
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
_See code: [src/commands/apex/get/test.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
205
|
+
_See code: [src/commands/apex/get/test.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/get/test.ts)_
|
|
206
206
|
|
|
207
207
|
## `sf apex list log`
|
|
208
208
|
|
|
@@ -242,7 +242,7 @@ EXAMPLES
|
|
|
242
242
|
$ sf apex list log --target-org me@my.org
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
_See code: [src/commands/apex/list/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
245
|
+
_See code: [src/commands/apex/list/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/list/log.ts)_
|
|
246
246
|
|
|
247
247
|
## `sf apex run`
|
|
248
248
|
|
|
@@ -289,7 +289,7 @@ EXAMPLES
|
|
|
289
289
|
$ sf apex run
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
_See code: [src/commands/apex/run.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
292
|
+
_See code: [src/commands/apex/run.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/run.ts)_
|
|
293
293
|
|
|
294
294
|
## `sf apex run test`
|
|
295
295
|
|
|
@@ -369,14 +369,45 @@ EXAMPLES
|
|
|
369
369
|
|
|
370
370
|
$ sf apex run test --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org
|
|
371
371
|
|
|
372
|
+
Run all tests in the org asynchronously:
|
|
373
|
+
|
|
374
|
+
$ sf apex run test --target-org myscratch
|
|
375
|
+
|
|
376
|
+
Run all tests synchronously; the command waits to display the test results until all tests finish:
|
|
377
|
+
|
|
378
|
+
$ sf apex run test --synchronous
|
|
379
|
+
|
|
380
|
+
Run specific tests using the --test-level flag:
|
|
381
|
+
|
|
382
|
+
$ sf apex run test --test-level RunLocalTests
|
|
383
|
+
|
|
384
|
+
Run Apex tests on all the methods in the specified class; output results in Test Anything Protocol (TAP) format and
|
|
385
|
+
request code coverage results:
|
|
386
|
+
|
|
387
|
+
$ sf apex run test --class-names TestA --class-names TestB --result-format tap --code-coverage
|
|
388
|
+
|
|
389
|
+
Run Apex tests on methods specified using the standard Class.method notation; if you specify a test class without a
|
|
390
|
+
method, the command runs all methods in the class:
|
|
391
|
+
|
|
392
|
+
$ sf apex run test --tests TestA.excitingMethod --tests TestA.boringMethod --tests TestB
|
|
393
|
+
|
|
394
|
+
Run Apex tests on methods specified using the standard Class.method notation with a namespace:
|
|
395
|
+
|
|
396
|
+
$ sf apex run test --tests ns.TestA.excitingMethod --tests ns.TestA.boringMethod --tests ns.TestB
|
|
397
|
+
|
|
372
398
|
FLAG DESCRIPTIONS
|
|
373
399
|
-l, --test-level=RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests Level of tests to run; default is RunLocalTests.
|
|
374
400
|
|
|
375
401
|
Here's what the levels mean:
|
|
376
402
|
|
|
377
|
-
- RunSpecifiedTests — Only the tests that you specify are run.
|
|
378
|
-
|
|
379
|
-
|
|
403
|
+
- RunSpecifiedTests — Only the tests that you specify in the runTests option are run. Code coverage requirements
|
|
404
|
+
differ from the default coverage requirements when using this test level. The executed tests must cover each class
|
|
405
|
+
and trigger in the deployment package for a minimum of 75% code coverage. This coverage is computed for each class
|
|
406
|
+
and triggers individually, and is different than the overall coverage percentage.
|
|
407
|
+
- RunLocalTests — All local tests in your org, including tests that originate from no-namespaced unlocked packages,
|
|
408
|
+
are run. The tests that originate from installed managed packages and namespaced unlocked packages aren't run. This
|
|
409
|
+
test level is the default for production deployments that include Apex classes or triggers.
|
|
410
|
+
- RunAllTestsInOrg — All tests are run. The tests include all tests in your org.
|
|
380
411
|
|
|
381
412
|
-n, --class-names=<value>... Apex test class names to run; default is all classes.
|
|
382
413
|
|
|
@@ -399,7 +430,7 @@ FLAG DESCRIPTIONS
|
|
|
399
430
|
--tests Test1 --tests Test2
|
|
400
431
|
```
|
|
401
432
|
|
|
402
|
-
_See code: [src/commands/apex/run/test.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
433
|
+
_See code: [src/commands/apex/run/test.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/run/test.ts)_
|
|
403
434
|
|
|
404
435
|
## `sf apex tail log`
|
|
405
436
|
|
|
@@ -442,6 +473,6 @@ EXAMPLES
|
|
|
442
473
|
$ sf apex tail log --color --skip-trace-flag
|
|
443
474
|
```
|
|
444
475
|
|
|
445
|
-
_See code: [src/commands/apex/tail/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.1
|
|
476
|
+
_See code: [src/commands/apex/tail/log.ts](https://github.com/salesforcecli/plugin-apex/blob/3.2.1/src/commands/apex/tail/log.ts)_
|
|
446
477
|
|
|
447
478
|
<!-- commandsstop -->
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { LogService } from '@salesforce/apex-node';
|
|
8
8
|
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Messages } from '@salesforce/core';
|
|
10
|
-
import { colorLogs } from '../../../
|
|
10
|
+
import { colorLogs } from '../../../logColorize.js';
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'get');
|
|
13
13
|
export default class Log extends SfCommand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;AAIzE,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,SAAuB;IAC/C,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QA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Aa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC;YACtB,YAAY,EAAE,KAAK,CAAC,MAAM;YAC1B,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;SAC/B,CAAC,CAAC;QAEH,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAChD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,wBAAwB,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACxD,iEAAiE;YACjE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAClC,IAAI,CAAC,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"}
|
|
@@ -8,7 +8,7 @@ import { TestService } from '@salesforce/apex-node';
|
|
|
8
8
|
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, Ux, } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Messages } from '@salesforce/core';
|
|
10
10
|
import { TestReporter } from '../../../reporters/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { codeCoverageFlag, resultFormatFlag } from '../../../flags.js';
|
|
12
12
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
13
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'gettest');
|
|
14
14
|
export default class Test extends SfCommand {
|
|
@@ -30,26 +30,14 @@ export default class Test extends SfCommand {
|
|
|
30
30
|
startsWith: '707',
|
|
31
31
|
length: 'both',
|
|
32
32
|
}),
|
|
33
|
-
'code-coverage':
|
|
34
|
-
aliases: ['codecoverage'],
|
|
35
|
-
deprecateAliases: true,
|
|
36
|
-
char: 'c',
|
|
37
|
-
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
38
|
-
}),
|
|
33
|
+
'code-coverage': codeCoverageFlag,
|
|
39
34
|
'output-dir': Flags.directory({
|
|
40
35
|
aliases: ['outputdir', 'output-directory'],
|
|
41
36
|
deprecateAliases: true,
|
|
42
37
|
char: 'd',
|
|
43
38
|
summary: messages.getMessage('flags.output-dir.summary'),
|
|
44
39
|
}),
|
|
45
|
-
'result-format':
|
|
46
|
-
deprecateAliases: true,
|
|
47
|
-
aliases: ['resultformat'],
|
|
48
|
-
char: 'r',
|
|
49
|
-
summary: messages.getMessage('flags.result-format.summary'),
|
|
50
|
-
options: resultFormat,
|
|
51
|
-
default: 'human',
|
|
52
|
-
}),
|
|
40
|
+
'result-format': resultFormatFlag,
|
|
53
41
|
};
|
|
54
42
|
async run() {
|
|
55
43
|
const { flags } = await this.parse(Test);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,EAC/B,SAAS,EACT,EAAE,GACH,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5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,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -13,5 +13,5 @@ export default class Log extends SfCommand<LogListResult> {
|
|
|
13
13
|
loglevel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<LogListResult>;
|
|
16
|
-
private formatTime;
|
|
17
16
|
}
|
|
17
|
+
export declare const formatStartTime: (lr: LogRecord) => LogRecord;
|
|
@@ -22,52 +22,39 @@ export default class Log extends SfCommand {
|
|
|
22
22
|
};
|
|
23
23
|
async run() {
|
|
24
24
|
const { flags } = await this.parse(Log);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const logRecords = await logService.getLogRecords();
|
|
25
|
+
const logService = new LogService(flags['target-org'].getConnection(flags['api-version']));
|
|
26
|
+
const logRecords = (await logService.getLogRecords()).map(formatStartTime);
|
|
28
27
|
if (logRecords.length === 0) {
|
|
29
28
|
this.log(messages.getMessage('noDebugLogsFound'));
|
|
30
29
|
return [];
|
|
31
30
|
}
|
|
32
|
-
logRecords.map((logRecord) => {
|
|
33
|
-
logRecord.StartTime = this.formatTime(logRecord.StartTime);
|
|
34
|
-
});
|
|
35
31
|
if (!flags.json) {
|
|
36
32
|
// while not required to prevent table output, save a few iterations if only printing json
|
|
37
|
-
|
|
38
|
-
app: logRecord.Application,
|
|
39
|
-
duration: String(logRecord.DurationMilliseconds),
|
|
40
|
-
id: logRecord.Id,
|
|
41
|
-
location: logRecord.Location,
|
|
42
|
-
size: String(logRecord.LogLength),
|
|
43
|
-
user: logRecord.LogUser.Name,
|
|
44
|
-
operation: logRecord.Operation,
|
|
45
|
-
request: logRecord.Request,
|
|
46
|
-
time: logRecord.StartTime,
|
|
47
|
-
status: logRecord.Status,
|
|
48
|
-
}));
|
|
49
|
-
this.table(cleanLogs, {
|
|
50
|
-
app: { header: messages.getMessage('appColHeader') },
|
|
51
|
-
duration: { header: messages.getMessage('durationColHeader') },
|
|
52
|
-
id: { header: messages.getMessage('idColHeader') },
|
|
53
|
-
location: { header: messages.getMessage('locationColHeader') },
|
|
54
|
-
size: { header: messages.getMessage('sizeColHeader') },
|
|
55
|
-
user: { header: messages.getMessage('userColHeader') },
|
|
56
|
-
operation: { header: messages.getMessage('operationColHeader') },
|
|
57
|
-
request: { header: messages.getMessage('requestColHeader') },
|
|
58
|
-
time: { header: messages.getMessage('timeColHeader') },
|
|
59
|
-
status: { header: messages.getMessage('statusColHeader') },
|
|
60
|
-
}, { 'no-truncate': true });
|
|
33
|
+
this.table(logRecords.map(formatForTable), tableHeaders, { 'no-truncate': true });
|
|
61
34
|
}
|
|
62
35
|
return logRecords;
|
|
63
36
|
}
|
|
64
|
-
// eslint-disable-next-line class-methods-use-this
|
|
65
|
-
formatTime(time) {
|
|
66
|
-
const milliIndex = time.indexOf('.');
|
|
67
|
-
if (milliIndex !== -1) {
|
|
68
|
-
return time.substring(0, milliIndex) + time.substring(milliIndex + 4);
|
|
69
|
-
}
|
|
70
|
-
return time;
|
|
71
|
-
}
|
|
72
37
|
}
|
|
38
|
+
const formatForTable = (logRecord) => ({
|
|
39
|
+
...logRecord,
|
|
40
|
+
DurationMilliseconds: String(logRecord.DurationMilliseconds),
|
|
41
|
+
User: logRecord.LogUser.Name,
|
|
42
|
+
});
|
|
43
|
+
export const formatStartTime = (lr) => ({ ...lr, StartTime: formatTime(lr.StartTime) });
|
|
44
|
+
const formatTime = (time) => {
|
|
45
|
+
const msIndex = time.indexOf('.');
|
|
46
|
+
return msIndex !== -1 ? time.substring(0, msIndex) + time.substring(msIndex + 4) : time;
|
|
47
|
+
};
|
|
48
|
+
const tableHeaders = {
|
|
49
|
+
Application: { header: 'Application' },
|
|
50
|
+
DurationMilliseconds: { header: 'Duration (ms)' },
|
|
51
|
+
Id: { header: 'Id' },
|
|
52
|
+
Location: { header: 'Location' },
|
|
53
|
+
LogLength: { header: 'Size (B)' },
|
|
54
|
+
User: { header: 'Log User' },
|
|
55
|
+
Operation: { header: 'Operation' },
|
|
56
|
+
Request: { header: 'Request' },
|
|
57
|
+
StartTime: { header: 'Start Time' },
|
|
58
|
+
Status: { header: 'Status' },
|
|
59
|
+
};
|
|
73
60
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/list/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/list/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAa,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;AAK1E,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,SAAwB;IAChD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,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AS,CAAC,OAAO,CAAC,IAAI;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAa,EAAa,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAE9G,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1F,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,WAAW,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;IACtC,oBAAoB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;IACjD,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IACpB,QAAQ,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;IAChC,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;IACjC,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;IAC5B,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;IAClC,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;IAC9B,SAAS,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;IACnC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;CAC7B,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { CancellationTokenSource, TestService } from '@salesforce/apex-node';
|
|
|
8
8
|
import { arrayWithDeprecation, Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, Ux, } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Messages, SfError } from '@salesforce/core';
|
|
10
10
|
import { TestReporter } from '../../../reporters/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { codeCoverageFlag, resultFormatFlag } from '../../../flags.js';
|
|
12
12
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
13
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtest');
|
|
14
14
|
export const TestLevelValues = ['RunLocalTests', 'RunAllTestsInOrg', 'RunSpecifiedTests'];
|
|
@@ -23,12 +23,7 @@ export default class Test extends SfCommand {
|
|
|
23
23
|
'target-org': requiredOrgFlagWithDeprecations,
|
|
24
24
|
'api-version': orgApiVersionFlagWithDeprecations,
|
|
25
25
|
loglevel,
|
|
26
|
-
'code-coverage':
|
|
27
|
-
aliases: ['codecoverage'],
|
|
28
|
-
deprecateAliases: true,
|
|
29
|
-
char: 'c',
|
|
30
|
-
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
31
|
-
}),
|
|
26
|
+
'code-coverage': codeCoverageFlag,
|
|
32
27
|
'output-dir': Flags.directory({
|
|
33
28
|
aliases: ['outputdir', 'output-directory'],
|
|
34
29
|
deprecateAliases: true,
|
|
@@ -51,14 +46,7 @@ export default class Test extends SfCommand {
|
|
|
51
46
|
description: messages.getMessage('flags.class-names.description'),
|
|
52
47
|
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'class-names'),
|
|
53
48
|
}),
|
|
54
|
-
'result-format':
|
|
55
|
-
deprecateAliases: true,
|
|
56
|
-
aliases: ['resultformat'],
|
|
57
|
-
char: 'r',
|
|
58
|
-
summary: messages.getMessage('flags.result-format.summary'),
|
|
59
|
-
options: resultFormat,
|
|
60
|
-
default: 'human',
|
|
61
|
-
}),
|
|
49
|
+
'result-format': resultFormatFlag,
|
|
62
50
|
'suite-names': arrayWithDeprecation({
|
|
63
51
|
deprecateAliases: true,
|
|
64
52
|
aliases: ['suitenames'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/run/test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAA0C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EACL,oBAAoB,EACpB,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,EAC/B,SAAS,EACT,EAAE,GACH,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAa,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/run/test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAA0C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EACL,oBAAoB,EACpB,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,+BAA+B,EAC/B,SAAS,EACT,EAAE,GACH,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAa,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AAE1F,MAAM,uBAAuB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AACxE,MAAM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U,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,IACE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;QACrD,SAAS;QACT,SAAS,CAAC,QAAQ,EAAE,KAAK,mBAAmB,EAC5C,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC;QACxD,6DAAmC;IACrC,CAAC;IACD,qDAA+B;AACjC,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { LogService } from '@salesforce/apex-node';
|
|
8
8
|
import { Flags, SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, loglevel, } from '@salesforce/sf-plugins-core';
|
|
9
9
|
import { Messages } from '@salesforce/core';
|
|
10
|
-
import {
|
|
10
|
+
import { colorLogs } from '../../../logColorize.js';
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'tail');
|
|
13
13
|
export default class Log extends SfCommand {
|
|
@@ -52,10 +52,11 @@ export default class Log extends SfCommand {
|
|
|
52
52
|
await logService.tail(flags['target-org'], this.logTailer.bind(this));
|
|
53
53
|
this.log(messages.getMessage('finishedTailing'));
|
|
54
54
|
}
|
|
55
|
+
// the colorize function used to be async, but not isn't. Preserving the public method signature
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
55
57
|
async logTailer(fullLog) {
|
|
56
58
|
if (fullLog) {
|
|
57
|
-
|
|
58
|
-
this.log(output);
|
|
59
|
+
this.log(this.color ? colorLogs(fullLog) : fullLog);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/tail/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/tail/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,SAAe;IACvC,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,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,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC9B,MAAM,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,yGAAyG;QACzG,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,iGAAiG;IACjG,4DAA4D;IACrD,KAAK,CAAC,SAAS,CAAC,OAAe;QACpC,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,kDAAkD;IAC1C,aAAa,CAAC,IAAgB;QACpC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC"}
|
package/lib/flags.d.ts
ADDED
package/lib/flags.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { Messages } from '@salesforce/core';
|
|
8
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
9
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
10
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'flags');
|
|
11
|
+
export const resultFormatFlag = Flags.string({
|
|
12
|
+
deprecateAliases: true,
|
|
13
|
+
aliases: ['resultformat'],
|
|
14
|
+
char: 'r',
|
|
15
|
+
summary: messages.getMessage('flags.result-format.summary'),
|
|
16
|
+
options: ['human', 'tap', 'junit', 'json'],
|
|
17
|
+
default: 'human',
|
|
18
|
+
});
|
|
19
|
+
export const codeCoverageFlag = Flags.boolean({
|
|
20
|
+
aliases: ['codecoverage'],
|
|
21
|
+
deprecateAliases: true,
|
|
22
|
+
char: 'c',
|
|
23
|
+
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=flags.js.map
|
package/lib/flags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3C,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;IAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAU;IACnD,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC;IAC5C,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,gBAAgB,EAAE,IAAI;IACtB,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;CAC5D,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** one or more functions that have the same signature, returns one composed function that does them all sequentially */
|
|
2
|
+
export declare const compose: <R>(fn1: (a: R) => R, ...fns: Array<(a: R) => R>) => ((a: R) => R);
|
|
3
|
+
/** all colorizers in one */
|
|
4
|
+
export declare const colorize: (a: string) => string;
|
|
5
|
+
export declare const colorLogs: (log: string) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
8
|
+
import ansis from 'ansis';
|
|
9
|
+
/** these color matching pieces of content within a log line */
|
|
10
|
+
const contentColorMap = [
|
|
11
|
+
[new RegExp(/\|VARIABLE_\w*\|/g), ansis.bold.cyan],
|
|
12
|
+
[new RegExp(/\|METHOD_\w*\|/g), ansis.blue],
|
|
13
|
+
[new RegExp(/\|SOQL_\w*\|/g), StandardColors.warning],
|
|
14
|
+
[new RegExp(/\|CONSTRUCTOR_\w*\|/g), ansis.magenta],
|
|
15
|
+
[new RegExp(/\|USER\w*\|/g), StandardColors.success],
|
|
16
|
+
[new RegExp(/\b([\w]+\.)+(\w)+\b/g), ansis.blueBright],
|
|
17
|
+
[new RegExp(/\b(DEBUG)\b/g), ansis.bold.cyan],
|
|
18
|
+
[new RegExp(/\b(HINT|INFO|INFORMATION|EXCEPTION_\w*|FATAL_\w*)\b/g), StandardColors.success],
|
|
19
|
+
[new RegExp(/\b(WARNING|WARN)\b/g), StandardColors.warning],
|
|
20
|
+
[new RegExp(/\b(ERROR|FAILURE|FAIL)\b/g), StandardColors.error],
|
|
21
|
+
[new RegExp(/\b([a-zA-Z.]*Exception)\b/g), StandardColors.error],
|
|
22
|
+
[new RegExp(/"[^"]*"/g), StandardColors.error],
|
|
23
|
+
[new RegExp(/\b([0-9]+|true|false|null)\b/g), ansis.blueBright],
|
|
24
|
+
];
|
|
25
|
+
/** apply a single color to a single log's matching content */
|
|
26
|
+
const colorLogMatchingContent = ([regex, colorFn]) => (log) => log.replace(regex, (match) => colorFn(match));
|
|
27
|
+
const [colorFn1, ...colorFns] = [...contentColorMap.map(colorLogMatchingContent)];
|
|
28
|
+
/** one or more functions that have the same signature, returns one composed function that does them all sequentially */
|
|
29
|
+
export const compose = (fn1, ...fns) => fns.reduce((prevFn, nextFn) => (value) => prevFn(nextFn(value)), fn1);
|
|
30
|
+
/** all colorizers in one */
|
|
31
|
+
export const colorize = compose(colorFn1, ...colorFns);
|
|
32
|
+
export const colorLogs = (log) => {
|
|
33
|
+
const [head, ...tail] = log.split('\n');
|
|
34
|
+
// the first line is bolded and not otherwise styles
|
|
35
|
+
return tail.length === 0
|
|
36
|
+
? ansis.bold(head)
|
|
37
|
+
: [
|
|
38
|
+
ansis.bold(head), // the first line is bolded and not otherwise styles
|
|
39
|
+
colorize(tail.join('\n')),
|
|
40
|
+
].join('\n');
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=logColorize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logColorize.js","sourceRoot":"","sources":["../src/logColorize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,+DAA+D;AAC/D,MAAM,eAAe,GAAG;IACtB,CAAC,IAAI,MAAM,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI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AC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAElF,wHAAwH;AACxH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,GAAgB,EAAE,GAAG,GAAuB,EAAiB,EAAE,CACxF,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAExE,4BAA4B;AAC5B,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,oDAAoD;IACpD,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC;QACtB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC;YACE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,oDAAoD;YACtE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import os from 'node:os';
|
|
8
8
|
import { Messages } from '@salesforce/core';
|
|
9
|
-
import {
|
|
9
|
+
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
10
10
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
11
11
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'run');
|
|
12
12
|
export default class RunReporter {
|
|
13
13
|
static formatDefault(response) {
|
|
14
14
|
const outputText = [];
|
|
15
15
|
if (response.success) {
|
|
16
|
-
outputText.push(
|
|
16
|
+
outputText.push(StandardColors.success(messages.getMessage('executeCompileSuccess')), StandardColors.success(messages.getMessage('executeRuntimeSuccess')), '', response.logs ?? '');
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
if (!response.diagnostic) {
|
|
@@ -21,10 +21,10 @@ export default class RunReporter {
|
|
|
21
21
|
}
|
|
22
22
|
const diagnostic = response.diagnostic[0];
|
|
23
23
|
if (!response.compiled) {
|
|
24
|
-
outputText.push(
|
|
24
|
+
outputText.push(StandardColors.error(`Error: Line: ${diagnostic.lineNumber}, Column: ${diagnostic.columnNumber}`), StandardColors.error(`Error: ${diagnostic.compileProblem}\n`));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
outputText.push(
|
|
27
|
+
outputText.push(StandardColors.success(messages.getMessage('executeCompileSuccess')), StandardColors.error(`Error: ${diagnostic.exceptionMessage}`), StandardColors.error(`Error: ${diagnostic.exceptionStackTrace}`), '', response.logs ?? '');
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
return outputText.join(os.EOL);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QA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CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,QAAkC;QACzD,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,cAAc,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,IAAI,EAAE;YAC7D,gBAAgB,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB,IAAI,EAAE;YACjE,mBAAmB,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,mBAAmB,IAAI,EAAE;YACvE,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;YAC/C,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;YACnD,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HumanReporter, JUnitReporter, ResultFormat, TapReporter, TestService, } from '@salesforce/apex-node';
|
|
8
8
|
import { Messages } from '@salesforce/core';
|
|
9
|
-
import { FAILURE_EXIT_CODE } from '../utils.js';
|
|
10
9
|
import { JsonReporter } from './jsonReporter.js';
|
|
10
|
+
const FAILURE_EXIT_CODE = 100;
|
|
11
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
12
|
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtest');
|
|
13
13
|
export class TestReporter {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":"A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,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAEO,MAAM,CAAC,MAAkB;QAC/B,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,QAAQ,CAAC,MAAkB;QACjC,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,CAAC;IAEO,gBAAgB,CAAC,MAAkB;QACzC,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC;QAChD,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,IAAI,OAAO,QAAQ,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,QAAQ,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IACjF,CAAC;CACF"}
|
package/messages/gettest.md
CHANGED
|
@@ -22,20 +22,13 @@ Provide a test run ID to display test results for an enqueued or completed async
|
|
|
22
22
|
|
|
23
23
|
- Specify a directory in which to save the test results from the org with the specified username (rather than your default org):
|
|
24
24
|
|
|
25
|
-
<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg'
|
|
25
|
+
<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg'
|
|
26
|
+
|
|
26
27
|
|
|
27
28
|
# flags.test-run-id.summary
|
|
28
29
|
|
|
29
30
|
ID of the test run.
|
|
30
31
|
|
|
31
|
-
# flags.result-format.summary
|
|
32
|
-
|
|
33
|
-
Format of the results.
|
|
34
|
-
|
|
35
|
-
# flags.code-coverage.summary
|
|
36
|
-
|
|
37
|
-
Retrieve code coverage results.
|
|
38
|
-
|
|
39
32
|
# flags.output-dir.summary
|
|
40
33
|
|
|
41
34
|
Directory in which to store test result files.
|
package/messages/list.md
CHANGED
|
@@ -21,43 +21,3 @@ To fetch a specific log from your org, obtain the ID from this command's output,
|
|
|
21
21
|
# noDebugLogsFound
|
|
22
22
|
|
|
23
23
|
No debug logs found in org
|
|
24
|
-
|
|
25
|
-
# appColHeader
|
|
26
|
-
|
|
27
|
-
APPLICATION
|
|
28
|
-
|
|
29
|
-
# durationColHeader
|
|
30
|
-
|
|
31
|
-
DURATION (MS)
|
|
32
|
-
|
|
33
|
-
# idColHeader
|
|
34
|
-
|
|
35
|
-
ID
|
|
36
|
-
|
|
37
|
-
# locationColHeader
|
|
38
|
-
|
|
39
|
-
LOCATION
|
|
40
|
-
|
|
41
|
-
# sizeColHeader
|
|
42
|
-
|
|
43
|
-
SIZE (B)
|
|
44
|
-
|
|
45
|
-
# userColHeader
|
|
46
|
-
|
|
47
|
-
LOG USER
|
|
48
|
-
|
|
49
|
-
# operationColHeader
|
|
50
|
-
|
|
51
|
-
OPERATION
|
|
52
|
-
|
|
53
|
-
# requestColHeader
|
|
54
|
-
|
|
55
|
-
REQUEST
|
|
56
|
-
|
|
57
|
-
# timeColHeader
|
|
58
|
-
|
|
59
|
-
START TIME
|
|
60
|
-
|
|
61
|
-
# statusColHeader
|
|
62
|
-
|
|
63
|
-
STATUS
|
package/messages/runtest.md
CHANGED
|
@@ -34,9 +34,30 @@ NOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage
|
|
|
34
34
|
|
|
35
35
|
<%= config.bin %> <%= command.id %> --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
- Run all tests in the org asynchronously:
|
|
38
|
+
|
|
39
|
+
<%= config.bin %> <%= command.id %> --target-org myscratch
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
- Run all tests synchronously; the command waits to display the test results until all tests finish:
|
|
42
|
+
|
|
43
|
+
<%= config.bin %> <%= command.id %> --synchronous
|
|
44
|
+
|
|
45
|
+
- Run specific tests using the --test-level flag:
|
|
46
|
+
|
|
47
|
+
<%= config.bin %> <%= command.id %> --test-level RunLocalTests
|
|
48
|
+
|
|
49
|
+
- Run Apex tests on all the methods in the specified class; output results in Test Anything Protocol (TAP) format and request code coverage results:
|
|
50
|
+
|
|
51
|
+
<%= config.bin %> <%= command.id %> --class-names TestA --class-names TestB --result-format tap --code-coverage
|
|
52
|
+
|
|
53
|
+
- Run Apex tests on methods specified using the standard Class.method notation; if you specify a test class without a method, the command runs all methods in the class:
|
|
54
|
+
|
|
55
|
+
<%= config.bin %> <%= command.id %> --tests TestA.excitingMethod --tests TestA.boringMethod --tests TestB
|
|
56
|
+
|
|
57
|
+
- Run Apex tests on methods specified using the standard Class.method notation with a namespace:
|
|
58
|
+
|
|
59
|
+
<%= config.bin %> <%= command.id %> --tests ns.TestA.excitingMethod --tests ns.TestA.boringMethod --tests ns.TestB
|
|
60
|
+
|
|
40
61
|
|
|
41
62
|
# flags.class-names.summary
|
|
42
63
|
|
|
@@ -84,9 +105,9 @@ Level of tests to run; default is RunLocalTests.
|
|
|
84
105
|
|
|
85
106
|
Here's what the levels mean:
|
|
86
107
|
|
|
87
|
-
- RunSpecifiedTests — Only the tests that you specify are run.
|
|
88
|
-
- RunLocalTests — All tests in your org are run
|
|
89
|
-
- RunAllTestsInOrg — All tests are
|
|
108
|
+
- 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.
|
|
109
|
+
- 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.
|
|
110
|
+
- RunAllTestsInOrg — All tests are run. The tests include all tests in your org.
|
|
90
111
|
|
|
91
112
|
# flags.wait.summary
|
|
92
113
|
|
package/oclif.manifest.json
CHANGED
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
"Display test results for your default org using a test run ID:\n<%= config.bin %> <%= command.id %> --test-run-id <test run id>",
|
|
270
270
|
"Similar to previous example, but output the result in JUnit format:\n<%= config.bin %> <%= command.id %> --test-run-id <test run id> --result-format junit",
|
|
271
271
|
"Also retrieve code coverage results and output in JSON format:\n<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --json",
|
|
272
|
-
"Specify a directory in which to save the test results from the org with the specified username (rather than your default org):\n<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg'
|
|
272
|
+
"Specify a directory in which to save the test results from the org with the specified username (rather than your default org):\n<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg'"
|
|
273
273
|
],
|
|
274
274
|
"flags": {
|
|
275
275
|
"json": {
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"char": "r",
|
|
368
368
|
"deprecateAliases": true,
|
|
369
369
|
"name": "result-format",
|
|
370
|
-
"summary": "Format of the results.",
|
|
370
|
+
"summary": "Format of the test results.",
|
|
371
371
|
"default": "human",
|
|
372
372
|
"hasDynamicHelp": false,
|
|
373
373
|
"multiple": false,
|
|
@@ -432,122 +432,6 @@
|
|
|
432
432
|
"test:get:apex"
|
|
433
433
|
]
|
|
434
434
|
},
|
|
435
|
-
"apex:list:log": {
|
|
436
|
-
"aliases": [
|
|
437
|
-
"force:apex:log:list"
|
|
438
|
-
],
|
|
439
|
-
"args": {},
|
|
440
|
-
"deprecateAliases": true,
|
|
441
|
-
"description": "Run this command in a project to list the IDs and general information for all debug logs in your default org.\n\nTo fetch a specific log from your org, obtain the ID from this command's output, then run the “<%= config.bin %> apex log get” command.",
|
|
442
|
-
"examples": [
|
|
443
|
-
"List the IDs and information about the debug logs in your default org:\n<%= config.bin %> <%= command.id %>",
|
|
444
|
-
"Similar to previous example, but use the org with the specified username:\n<%= config.bin %> <%= command.id %> --target-org me@my.org"
|
|
445
|
-
],
|
|
446
|
-
"flags": {
|
|
447
|
-
"json": {
|
|
448
|
-
"description": "Format output as json.",
|
|
449
|
-
"helpGroup": "GLOBAL",
|
|
450
|
-
"name": "json",
|
|
451
|
-
"allowNo": false,
|
|
452
|
-
"type": "boolean"
|
|
453
|
-
},
|
|
454
|
-
"flags-dir": {
|
|
455
|
-
"helpGroup": "GLOBAL",
|
|
456
|
-
"name": "flags-dir",
|
|
457
|
-
"summary": "Import flag values from a directory.",
|
|
458
|
-
"hasDynamicHelp": false,
|
|
459
|
-
"multiple": false,
|
|
460
|
-
"type": "option"
|
|
461
|
-
},
|
|
462
|
-
"target-org": {
|
|
463
|
-
"aliases": [
|
|
464
|
-
"targetusername",
|
|
465
|
-
"u"
|
|
466
|
-
],
|
|
467
|
-
"char": "o",
|
|
468
|
-
"deprecateAliases": true,
|
|
469
|
-
"name": "target-org",
|
|
470
|
-
"noCacheDefault": true,
|
|
471
|
-
"required": true,
|
|
472
|
-
"summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
|
|
473
|
-
"hasDynamicHelp": true,
|
|
474
|
-
"multiple": false,
|
|
475
|
-
"type": "option"
|
|
476
|
-
},
|
|
477
|
-
"api-version": {
|
|
478
|
-
"aliases": [
|
|
479
|
-
"apiversion"
|
|
480
|
-
],
|
|
481
|
-
"deprecateAliases": true,
|
|
482
|
-
"description": "Override the api version used for api requests made by this command",
|
|
483
|
-
"name": "api-version",
|
|
484
|
-
"hasDynamicHelp": false,
|
|
485
|
-
"multiple": false,
|
|
486
|
-
"type": "option"
|
|
487
|
-
},
|
|
488
|
-
"loglevel": {
|
|
489
|
-
"deprecated": {
|
|
490
|
-
"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."
|
|
491
|
-
},
|
|
492
|
-
"hidden": true,
|
|
493
|
-
"name": "loglevel",
|
|
494
|
-
"hasDynamicHelp": false,
|
|
495
|
-
"multiple": false,
|
|
496
|
-
"type": "option"
|
|
497
|
-
}
|
|
498
|
-
},
|
|
499
|
-
"hasDynamicHelp": true,
|
|
500
|
-
"hiddenAliases": [],
|
|
501
|
-
"id": "apex:list:log",
|
|
502
|
-
"pluginAlias": "@salesforce/plugin-apex",
|
|
503
|
-
"pluginName": "@salesforce/plugin-apex",
|
|
504
|
-
"pluginType": "core",
|
|
505
|
-
"strict": true,
|
|
506
|
-
"summary": "Display a list of IDs and general information about debug logs.",
|
|
507
|
-
"enableJsonFlag": true,
|
|
508
|
-
"isESM": true,
|
|
509
|
-
"relativePath": [
|
|
510
|
-
"lib",
|
|
511
|
-
"commands",
|
|
512
|
-
"apex",
|
|
513
|
-
"list",
|
|
514
|
-
"log.js"
|
|
515
|
-
],
|
|
516
|
-
"aliasPermutations": [
|
|
517
|
-
"force:apex:log:list",
|
|
518
|
-
"apex:force:log:list",
|
|
519
|
-
"apex:log:force:list",
|
|
520
|
-
"apex:log:list:force",
|
|
521
|
-
"force:log:apex:list",
|
|
522
|
-
"log:force:apex:list",
|
|
523
|
-
"log:apex:force:list",
|
|
524
|
-
"log:apex:list:force",
|
|
525
|
-
"force:log:list:apex",
|
|
526
|
-
"log:force:list:apex",
|
|
527
|
-
"log:list:force:apex",
|
|
528
|
-
"log:list:apex:force",
|
|
529
|
-
"force:apex:list:log",
|
|
530
|
-
"apex:force:list:log",
|
|
531
|
-
"apex:list:force:log",
|
|
532
|
-
"apex:list:log:force",
|
|
533
|
-
"force:list:apex:log",
|
|
534
|
-
"list:force:apex:log",
|
|
535
|
-
"list:apex:force:log",
|
|
536
|
-
"list:apex:log:force",
|
|
537
|
-
"force:list:log:apex",
|
|
538
|
-
"list:force:log:apex",
|
|
539
|
-
"list:log:force:apex",
|
|
540
|
-
"list:log:apex:force"
|
|
541
|
-
],
|
|
542
|
-
"permutations": [
|
|
543
|
-
"apex:list:log",
|
|
544
|
-
"list:apex:log",
|
|
545
|
-
"list:log:apex",
|
|
546
|
-
"apex:log:list",
|
|
547
|
-
"log:apex:list",
|
|
548
|
-
"log:list:apex"
|
|
549
|
-
]
|
|
550
|
-
},
|
|
551
435
|
"apex:run:test": {
|
|
552
436
|
"aliases": [
|
|
553
437
|
"force:apex:test:run"
|
|
@@ -560,7 +444,13 @@
|
|
|
560
444
|
"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",
|
|
561
445
|
"Run the specified Apex test suites in your default org and include code coverage results and additional details:\n<%= config.bin %> <%= command.id %> --suite-names MySuite --suite-names MyOtherSuite --code-coverage --detailed-coverage",
|
|
562
446
|
"Run the specified Apex tests in your default org and display results in human-readable output:\n<%= config.bin %> <%= command.id %> --tests MyClassTest.testCoolFeature --tests MyClassTest.testAwesomeFeature --tests AnotherClassTest --tests namespace.TheirClassTest.testThis --result-format human",
|
|
563
|
-
"Run all tests in the org with the specified username with the specified test level; save the output to the specified directory:\n<%= config.bin %> <%= command.id %> --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org"
|
|
447
|
+
"Run all tests in the org with the specified username with the specified test level; save the output to the specified directory:\n<%= config.bin %> <%= command.id %> --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org",
|
|
448
|
+
"Run all tests in the org asynchronously:\n<%= config.bin %> <%= command.id %> --target-org myscratch",
|
|
449
|
+
"Run all tests synchronously; the command waits to display the test results until all tests finish:\n<%= config.bin %> <%= command.id %> --synchronous",
|
|
450
|
+
"Run specific tests using the --test-level flag:\n<%= config.bin %> <%= command.id %> --test-level RunLocalTests",
|
|
451
|
+
"Run Apex tests on all the methods in the specified class; output results in Test Anything Protocol (TAP) format and request code coverage results:\n<%= config.bin %> <%= command.id %> --class-names TestA --class-names TestB --result-format tap --code-coverage",
|
|
452
|
+
"Run Apex tests on methods specified using the standard Class.method notation; if you specify a test class without a method, the command runs all methods in the class:\n<%= config.bin %> <%= command.id %> --tests TestA.excitingMethod --tests TestA.boringMethod --tests TestB",
|
|
453
|
+
"Run Apex tests on methods specified using the standard Class.method notation with a namespace:\n<%= config.bin %> <%= command.id %> --tests ns.TestA.excitingMethod --tests ns.TestA.boringMethod --tests ns.TestB"
|
|
564
454
|
],
|
|
565
455
|
"flags": {
|
|
566
456
|
"json": {
|
|
@@ -644,7 +534,7 @@
|
|
|
644
534
|
],
|
|
645
535
|
"char": "l",
|
|
646
536
|
"deprecateAliases": true,
|
|
647
|
-
"description": "Here's what the levels mean:\n\n- RunSpecifiedTests — Only the tests that you specify are run.\n- RunLocalTests — All tests in your org are run
|
|
537
|
+
"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.",
|
|
648
538
|
"name": "test-level",
|
|
649
539
|
"summary": "Level of tests to run; default is RunLocalTests.",
|
|
650
540
|
"hasDynamicHelp": false,
|
|
@@ -807,6 +697,122 @@
|
|
|
807
697
|
"test:run:apex"
|
|
808
698
|
]
|
|
809
699
|
},
|
|
700
|
+
"apex:list:log": {
|
|
701
|
+
"aliases": [
|
|
702
|
+
"force:apex:log:list"
|
|
703
|
+
],
|
|
704
|
+
"args": {},
|
|
705
|
+
"deprecateAliases": true,
|
|
706
|
+
"description": "Run this command in a project to list the IDs and general information for all debug logs in your default org.\n\nTo fetch a specific log from your org, obtain the ID from this command's output, then run the “<%= config.bin %> apex log get” command.",
|
|
707
|
+
"examples": [
|
|
708
|
+
"List the IDs and information about the debug logs in your default org:\n<%= config.bin %> <%= command.id %>",
|
|
709
|
+
"Similar to previous example, but use the org with the specified username:\n<%= config.bin %> <%= command.id %> --target-org me@my.org"
|
|
710
|
+
],
|
|
711
|
+
"flags": {
|
|
712
|
+
"json": {
|
|
713
|
+
"description": "Format output as json.",
|
|
714
|
+
"helpGroup": "GLOBAL",
|
|
715
|
+
"name": "json",
|
|
716
|
+
"allowNo": false,
|
|
717
|
+
"type": "boolean"
|
|
718
|
+
},
|
|
719
|
+
"flags-dir": {
|
|
720
|
+
"helpGroup": "GLOBAL",
|
|
721
|
+
"name": "flags-dir",
|
|
722
|
+
"summary": "Import flag values from a directory.",
|
|
723
|
+
"hasDynamicHelp": false,
|
|
724
|
+
"multiple": false,
|
|
725
|
+
"type": "option"
|
|
726
|
+
},
|
|
727
|
+
"target-org": {
|
|
728
|
+
"aliases": [
|
|
729
|
+
"targetusername",
|
|
730
|
+
"u"
|
|
731
|
+
],
|
|
732
|
+
"char": "o",
|
|
733
|
+
"deprecateAliases": true,
|
|
734
|
+
"name": "target-org",
|
|
735
|
+
"noCacheDefault": true,
|
|
736
|
+
"required": true,
|
|
737
|
+
"summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
|
|
738
|
+
"hasDynamicHelp": true,
|
|
739
|
+
"multiple": false,
|
|
740
|
+
"type": "option"
|
|
741
|
+
},
|
|
742
|
+
"api-version": {
|
|
743
|
+
"aliases": [
|
|
744
|
+
"apiversion"
|
|
745
|
+
],
|
|
746
|
+
"deprecateAliases": true,
|
|
747
|
+
"description": "Override the api version used for api requests made by this command",
|
|
748
|
+
"name": "api-version",
|
|
749
|
+
"hasDynamicHelp": false,
|
|
750
|
+
"multiple": false,
|
|
751
|
+
"type": "option"
|
|
752
|
+
},
|
|
753
|
+
"loglevel": {
|
|
754
|
+
"deprecated": {
|
|
755
|
+
"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."
|
|
756
|
+
},
|
|
757
|
+
"hidden": true,
|
|
758
|
+
"name": "loglevel",
|
|
759
|
+
"hasDynamicHelp": false,
|
|
760
|
+
"multiple": false,
|
|
761
|
+
"type": "option"
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
"hasDynamicHelp": true,
|
|
765
|
+
"hiddenAliases": [],
|
|
766
|
+
"id": "apex:list:log",
|
|
767
|
+
"pluginAlias": "@salesforce/plugin-apex",
|
|
768
|
+
"pluginName": "@salesforce/plugin-apex",
|
|
769
|
+
"pluginType": "core",
|
|
770
|
+
"strict": true,
|
|
771
|
+
"summary": "Display a list of IDs and general information about debug logs.",
|
|
772
|
+
"enableJsonFlag": true,
|
|
773
|
+
"isESM": true,
|
|
774
|
+
"relativePath": [
|
|
775
|
+
"lib",
|
|
776
|
+
"commands",
|
|
777
|
+
"apex",
|
|
778
|
+
"list",
|
|
779
|
+
"log.js"
|
|
780
|
+
],
|
|
781
|
+
"aliasPermutations": [
|
|
782
|
+
"force:apex:log:list",
|
|
783
|
+
"apex:force:log:list",
|
|
784
|
+
"apex:log:force:list",
|
|
785
|
+
"apex:log:list:force",
|
|
786
|
+
"force:log:apex:list",
|
|
787
|
+
"log:force:apex:list",
|
|
788
|
+
"log:apex:force:list",
|
|
789
|
+
"log:apex:list:force",
|
|
790
|
+
"force:log:list:apex",
|
|
791
|
+
"log:force:list:apex",
|
|
792
|
+
"log:list:force:apex",
|
|
793
|
+
"log:list:apex:force",
|
|
794
|
+
"force:apex:list:log",
|
|
795
|
+
"apex:force:list:log",
|
|
796
|
+
"apex:list:force:log",
|
|
797
|
+
"apex:list:log:force",
|
|
798
|
+
"force:list:apex:log",
|
|
799
|
+
"list:force:apex:log",
|
|
800
|
+
"list:apex:force:log",
|
|
801
|
+
"list:apex:log:force",
|
|
802
|
+
"force:list:log:apex",
|
|
803
|
+
"list:force:log:apex",
|
|
804
|
+
"list:log:force:apex",
|
|
805
|
+
"list:log:apex:force"
|
|
806
|
+
],
|
|
807
|
+
"permutations": [
|
|
808
|
+
"apex:list:log",
|
|
809
|
+
"list:apex:log",
|
|
810
|
+
"list:log:apex",
|
|
811
|
+
"apex:log:list",
|
|
812
|
+
"log:apex:list",
|
|
813
|
+
"log:list:apex"
|
|
814
|
+
]
|
|
815
|
+
},
|
|
810
816
|
"apex:tail:log": {
|
|
811
817
|
"aliases": [
|
|
812
818
|
"force:apex:log:tail"
|
|
@@ -951,5 +957,5 @@
|
|
|
951
957
|
]
|
|
952
958
|
}
|
|
953
959
|
},
|
|
954
|
-
"version": "3.1
|
|
960
|
+
"version": "3.2.1"
|
|
955
961
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-apex",
|
|
3
3
|
"description": "Apex commands",
|
|
4
|
-
"version": "3.1
|
|
4
|
+
"version": "3.2.1",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -10,20 +10,17 @@
|
|
|
10
10
|
"@salesforce/core": "^7.4.1",
|
|
11
11
|
"@salesforce/kit": "^3.1.6",
|
|
12
12
|
"@salesforce/sf-plugins-core": "^11.1.0",
|
|
13
|
-
"
|
|
14
|
-
"color-convert": "^2.0.1",
|
|
15
|
-
"color-name": "^2.0.0"
|
|
13
|
+
"ansis": "^3.2.0"
|
|
16
14
|
},
|
|
17
15
|
"devDependencies": {
|
|
18
|
-
"@oclif/plugin-command-snapshot": "^5.2.
|
|
19
|
-
"@salesforce/cli-plugins-testkit": "^5.3.
|
|
20
|
-
"@salesforce/dev-scripts": "^10.
|
|
16
|
+
"@oclif/plugin-command-snapshot": "^5.2.3",
|
|
17
|
+
"@salesforce/cli-plugins-testkit": "^5.3.16",
|
|
18
|
+
"@salesforce/dev-scripts": "^10.2.0",
|
|
21
19
|
"@salesforce/plugin-command-reference": "^3.1.2",
|
|
22
|
-
"
|
|
23
|
-
"eslint-plugin-sf-plugin": "^1.18.5",
|
|
20
|
+
"eslint-plugin-sf-plugin": "^1.18.9",
|
|
24
21
|
"oclif": "^4.12.1",
|
|
25
22
|
"ts-node": "^10.9.2",
|
|
26
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.5.2"
|
|
27
24
|
},
|
|
28
25
|
"engines": {
|
|
29
26
|
"node": ">=18.0.0"
|
|
@@ -220,7 +217,7 @@
|
|
|
220
217
|
"exports": "./lib/index.js",
|
|
221
218
|
"type": "module",
|
|
222
219
|
"sfdx": {
|
|
223
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.1.
|
|
224
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.1.
|
|
220
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.2.1.crt",
|
|
221
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-apex/3.2.1.sig"
|
|
225
222
|
}
|
|
226
223
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { readFile } from 'node:fs/promises';
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
import convert from 'color-convert';
|
|
10
|
-
import { Logger } from '@salesforce/core';
|
|
11
|
-
const DEFAULT_COLOR_MAP = {
|
|
12
|
-
CONSTRUCTOR_: 'magenta',
|
|
13
|
-
EXCEPTION_: 'red',
|
|
14
|
-
FATAL_: 'red',
|
|
15
|
-
METHOD_: 'blue',
|
|
16
|
-
SOQL_: 'yellow',
|
|
17
|
-
USER_: 'green',
|
|
18
|
-
VARIABLE_: 'darkcyan',
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @description this is a holdover from the toolbelt API, which allows for custom colorization of the logs.
|
|
22
|
-
* @param log - full debug log retrieved from an org.
|
|
23
|
-
* @returns colorized log
|
|
24
|
-
*/
|
|
25
|
-
export async function colorizeLog(log) {
|
|
26
|
-
const logger = await Logger.child('apexLogApi', { tag: 'tail' });
|
|
27
|
-
let colorMap = DEFAULT_COLOR_MAP;
|
|
28
|
-
const localColorMapFile = process.env.SFDX_APEX_LOG_COLOR_MAP;
|
|
29
|
-
if (localColorMapFile) {
|
|
30
|
-
try {
|
|
31
|
-
colorMap = JSON.parse(await readFile(localColorMapFile, 'utf-8'));
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
logger.warn(`Color registry not found: ${localColorMapFile}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const logLines = log.split(/\n/g);
|
|
38
|
-
if (!logLines || logLines.length < 1) {
|
|
39
|
-
logger.warn('colorizeLog unable to split logLines');
|
|
40
|
-
return log;
|
|
41
|
-
}
|
|
42
|
-
const line1 = chalk.bold(logLines.shift());
|
|
43
|
-
return [
|
|
44
|
-
line1,
|
|
45
|
-
...logLines.map((logLine) => {
|
|
46
|
-
for (const [key, color] of Object.entries(colorMap)) {
|
|
47
|
-
if (logLine.includes(`|${key}`)) {
|
|
48
|
-
const hex = convert.keyword.hex(color);
|
|
49
|
-
const colorFn = chalk.hex(hex);
|
|
50
|
-
if (typeof colorFn !== 'function') {
|
|
51
|
-
logger.warn(`Color ${color} is not supported`);
|
|
52
|
-
return logLine;
|
|
53
|
-
}
|
|
54
|
-
const count = (logLine.match(/\|/g) ?? []).length;
|
|
55
|
-
if (count === 1) {
|
|
56
|
-
return colorFn(logLine);
|
|
57
|
-
}
|
|
58
|
-
const first = logLine.indexOf('|', logLine.indexOf('|') + 1);
|
|
59
|
-
return `${colorFn(logLine.substring(0, first))}${logLine.substring(first)}`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return logLine;
|
|
63
|
-
}),
|
|
64
|
-
].join('\n');
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=legacyColorization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacyColorization.js","sourceRoot":"","sources":["../src/legacyColorization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO1C,MAAM,iBAAiB,GAAa;IAClC,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,UAAU;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,IAAI,QAAQ,GAAG,iBAAiB,CAAC;IAEjC,MAAM,iBAAiB,GAAG,OAAO,CA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,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;oBAClD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;wBAChB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;oBAC1B,CAAC;oBACD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC7D,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9E,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/lib/utils.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const FAILURE_EXIT_CODE = 100;
|
|
2
|
-
export declare const colorSuccess: import("chalk").ChalkInstance;
|
|
3
|
-
export declare const colorError: import("chalk").ChalkInstance;
|
|
4
|
-
export declare const resultFormat: string[];
|
|
5
|
-
export declare function colorLogs(log: string): string;
|
package/lib/utils.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
export const FAILURE_EXIT_CODE = 100;
|
|
9
|
-
export const colorSuccess = chalk.bold.green;
|
|
10
|
-
export const colorError = chalk.bold.red;
|
|
11
|
-
export const resultFormat = ['human', 'tap', 'junit', 'json'];
|
|
12
|
-
const colorMap = new Map([
|
|
13
|
-
[new RegExp(/\b([\w]+\.)+(\w)+\b/g), chalk.blueBright],
|
|
14
|
-
[new RegExp(/\b(DEBUG)\b/g), chalk.bold.cyan],
|
|
15
|
-
[new RegExp(/\b(HINT|INFO|INFORMATION)\b/g), chalk.bold.green],
|
|
16
|
-
[new RegExp(/\b(WARNING|WARN)\b/g), chalk.bold.yellow],
|
|
17
|
-
[new RegExp(/\b(ERROR|FAILURE|FAIL)\b/g), chalk.bold.red],
|
|
18
|
-
[new RegExp(/\b([a-zA-Z.]*Exception)\b/g), chalk.bold.red],
|
|
19
|
-
[new RegExp(/"[^"]*"/g), chalk.bold.red],
|
|
20
|
-
[new RegExp(/\b([0-9]+|true|false|null)\b/g), chalk.blueBright],
|
|
21
|
-
]);
|
|
22
|
-
function replace(regex, word) {
|
|
23
|
-
const color = colorMap.get(regex);
|
|
24
|
-
if (!color) {
|
|
25
|
-
throw new Error('Error retrieving colors');
|
|
26
|
-
}
|
|
27
|
-
return word.replace(regex, (match) => `${color(match)}`);
|
|
28
|
-
}
|
|
29
|
-
export function colorLogs(log) {
|
|
30
|
-
for (const c of colorMap.keys()) {
|
|
31
|
-
log = replace(c, log);
|
|
32
|
-
}
|
|
33
|
-
return log;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MA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