@salesforce/plugin-apex 1.5.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/lib/commands/apex/get/log.d.ts +20 -0
- package/lib/commands/apex/get/log.js +73 -0
- package/lib/commands/apex/get/log.js.map +1 -0
- package/lib/commands/apex/get/test.d.ts +19 -0
- package/lib/commands/apex/get/test.js +74 -0
- package/lib/commands/apex/get/test.js.map +1 -0
- package/lib/commands/apex/list/log.d.ts +17 -0
- package/lib/commands/apex/list/log.js +76 -0
- package/lib/commands/apex/list/log.js.map +1 -0
- package/lib/commands/apex/run/test.d.ts +33 -0
- package/lib/commands/apex/run/test.js +198 -0
- package/lib/commands/apex/run/test.js.map +1 -0
- package/lib/commands/apex/run.d.ts +25 -0
- package/lib/commands/apex/run.js +53 -0
- package/lib/commands/apex/run.js.map +1 -0
- package/lib/commands/apex/tail/log.d.ts +26 -0
- package/lib/commands/apex/tail/log.js +81 -0
- package/lib/commands/apex/tail/log.js.map +1 -0
- package/lib/legacyColorization.js +36 -38
- package/lib/legacyColorization.js.map +1 -1
- package/lib/reporters/index.d.ts +2 -2
- package/lib/reporters/index.js +3 -3
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/jsonReporter.d.ts +33 -16
- package/lib/reporters/jsonReporter.js +23 -9
- package/lib/reporters/jsonReporter.js.map +1 -1
- package/lib/reporters/runReporter.d.ts +6 -0
- package/lib/reporters/runReporter.js +48 -0
- package/lib/reporters/runReporter.js.map +1 -0
- package/lib/reporters/testReporter.d.ts +44 -0
- package/lib/reporters/testReporter.js +170 -0
- package/lib/reporters/testReporter.js.map +1 -0
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +2 -21
- package/lib/utils.js.map +1 -1
- package/messages/get.md +45 -0
- package/messages/list.md +63 -0
- package/messages/report.md +45 -0
- package/messages/run.md +48 -0
- package/messages/runtest.md +129 -0
- package/messages/tail.md +37 -0
- package/oclif.manifest.json +426 -800
- package/package.json +30 -30
- package/lib/commands/force/apex/execute.d.ts +0 -16
- package/lib/commands/force/apex/execute.js +0 -109
- package/lib/commands/force/apex/execute.js.map +0 -1
- package/lib/commands/force/apex/log/get.d.ts +0 -17
- package/lib/commands/force/apex/log/get.js +0 -103
- package/lib/commands/force/apex/log/get.js.map +0 -1
- package/lib/commands/force/apex/log/list.d.ts +0 -17
- package/lib/commands/force/apex/log/list.js +0 -151
- package/lib/commands/force/apex/log/list.js.map +0 -1
- package/lib/commands/force/apex/log/tail.d.ts +0 -17
- package/lib/commands/force/apex/log/tail.js +0 -96
- package/lib/commands/force/apex/log/tail.js.map +0 -1
- package/lib/commands/force/apex/test/report.d.ts +0 -25
- package/lib/commands/force/apex/test/report.js +0 -175
- package/lib/commands/force/apex/test/report.js.map +0 -1
- package/lib/commands/force/apex/test/run.d.ts +0 -40
- package/lib/commands/force/apex/test/run.js +0 -299
- package/lib/commands/force/apex/test/run.js.map +0 -1
- package/lib/reporters/util.d.ts +0 -14
- package/lib/reporters/util.js +0 -78
- package/lib/reporters/util.js.map +0 -1
- package/messages/execute.json +0 -9
- package/messages/get.json +0 -12
- package/messages/list.json +0 -18
- package/messages/messages.json +0 -22
- package/messages/org.json +0 -6
- package/messages/report.json +0 -23
- package/messages/run.json +0 -34
- package/messages/tail.json +0 -12
- package/yarn.lock +0 -8992
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestReporter = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const apex_node_1 = require("@salesforce/apex-node");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const jsonReporter_1 = require("./jsonReporter");
|
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-apex', 'runtest');
|
|
16
|
+
class TestReporter {
|
|
17
|
+
/**
|
|
18
|
+
* Create a TestReporter that will format test results
|
|
19
|
+
*
|
|
20
|
+
* @param ux a new Ux instance based on if the command is in json mode
|
|
21
|
+
* @param connection a connection to the org the tests are being run against - used for getting username for hints
|
|
22
|
+
* @param bin the bin of the cli, used for providing suggestions in the users cli
|
|
23
|
+
*/
|
|
24
|
+
constructor(ux, connection, bin) {
|
|
25
|
+
this.ux = ux;
|
|
26
|
+
this.connection = connection;
|
|
27
|
+
this.bin = bin;
|
|
28
|
+
}
|
|
29
|
+
async report(result, options) {
|
|
30
|
+
if (options['output-dir']) {
|
|
31
|
+
const jsonOutput = this.formatResultInJson(result);
|
|
32
|
+
const outputDirConfig = this.buildOutputDirConfig(result, jsonOutput, options['output-dir'], options['result-format'], options['detailed-coverage'], options.synchronous);
|
|
33
|
+
const testService = new apex_node_1.TestService(this.connection);
|
|
34
|
+
await testService.writeResultFiles(result, outputDirConfig, options['code-coverage']);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
if (result.summary && result.summary.outcome === "Failed" /* ApexTestRunResultStatus.Failed */) {
|
|
38
|
+
process.exitCode = utils_1.FAILURE_EXIT_CODE;
|
|
39
|
+
}
|
|
40
|
+
switch (options['result-format']) {
|
|
41
|
+
case 'human':
|
|
42
|
+
this.logHuman(result, options['detailed-coverage'], options['output-dir']);
|
|
43
|
+
break;
|
|
44
|
+
case 'tap':
|
|
45
|
+
this.logTap(result);
|
|
46
|
+
break;
|
|
47
|
+
case 'junit':
|
|
48
|
+
this.logJUnit(result);
|
|
49
|
+
break;
|
|
50
|
+
case 'json':
|
|
51
|
+
// when --json flag is specified, we should log CLI json format
|
|
52
|
+
if (!options.json) {
|
|
53
|
+
this.ux.styledJSON({
|
|
54
|
+
status: process.exitCode,
|
|
55
|
+
result: this.formatResultInJson(result),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
this.logHuman(result, options['detailed-coverage'], options['output-dir']);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
this.ux.styledJSON(result);
|
|
65
|
+
throw messages.createError('testResultProcessErr', [e.message]);
|
|
66
|
+
}
|
|
67
|
+
return this.formatResultInJson(result);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Builds output directory configuration with CLI format result files
|
|
71
|
+
*
|
|
72
|
+
* @param result Test results from async/sync test run
|
|
73
|
+
* @param jsonOutput JSON CLI format of test results
|
|
74
|
+
* @param outputDir Output directory for result files
|
|
75
|
+
* @param resultFormat Result format for output files
|
|
76
|
+
* @param detailedCoverage Boolean to control detailed coverage reporting
|
|
77
|
+
* @param synchronous Whether the test run was synchronous
|
|
78
|
+
* @returns Output directory configuration
|
|
79
|
+
*/
|
|
80
|
+
// eslint-disable-next-line class-methods-use-this
|
|
81
|
+
buildOutputDirConfig(result, jsonOutput, outputDir, resultFormat, detailedCoverage, synchronous = false) {
|
|
82
|
+
const outputDirConfig = {
|
|
83
|
+
dirPath: outputDir,
|
|
84
|
+
};
|
|
85
|
+
if ('summary' in result) {
|
|
86
|
+
jsonOutput = jsonOutput;
|
|
87
|
+
if (typeof resultFormat !== 'undefined' || synchronous) {
|
|
88
|
+
outputDirConfig.fileInfos = [
|
|
89
|
+
{
|
|
90
|
+
filename: result.summary.testRunId ? `test-result-${result.summary.testRunId}.json` : 'test-result.json',
|
|
91
|
+
content: jsonOutput,
|
|
92
|
+
},
|
|
93
|
+
...(jsonOutput.coverage
|
|
94
|
+
? [
|
|
95
|
+
{
|
|
96
|
+
filename: 'test-result-codecoverage.json',
|
|
97
|
+
content: jsonOutput.coverage?.coverage,
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
: []),
|
|
101
|
+
];
|
|
102
|
+
outputDirConfig.resultFormats = [apex_node_1.ResultFormat.junit];
|
|
103
|
+
}
|
|
104
|
+
if (typeof resultFormat === 'undefined' && synchronous) {
|
|
105
|
+
resultFormat = apex_node_1.ResultFormat.human;
|
|
106
|
+
}
|
|
107
|
+
switch (resultFormat) {
|
|
108
|
+
case apex_node_1.ResultFormat.tap:
|
|
109
|
+
outputDirConfig.fileInfos?.push({
|
|
110
|
+
filename: 'test-result.txt',
|
|
111
|
+
content: new apex_node_1.TapReporter().format(result),
|
|
112
|
+
});
|
|
113
|
+
outputDirConfig.resultFormats?.push(apex_node_1.ResultFormat.tap);
|
|
114
|
+
break;
|
|
115
|
+
case apex_node_1.ResultFormat.junit:
|
|
116
|
+
outputDirConfig.fileInfos?.push({
|
|
117
|
+
filename: 'test-result.xml',
|
|
118
|
+
content: new apex_node_1.JUnitReporter().format(result),
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
case apex_node_1.ResultFormat.human:
|
|
122
|
+
outputDirConfig.fileInfos?.push({
|
|
123
|
+
filename: 'test-result.txt',
|
|
124
|
+
content: new apex_node_1.HumanReporter().format(result, detailedCoverage),
|
|
125
|
+
});
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return outputDirConfig;
|
|
132
|
+
}
|
|
133
|
+
formatResultInJson(result) {
|
|
134
|
+
try {
|
|
135
|
+
const reporter = new jsonReporter_1.JsonReporter();
|
|
136
|
+
return reporter.format(result);
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
this.ux.styledJSON(result);
|
|
140
|
+
throw messages.createError('testResultProcessErr', [e.message]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
logHuman(result, detailedCoverage, outputDir) {
|
|
144
|
+
if (outputDir) {
|
|
145
|
+
this.ux.log(messages.getMessage('outputDirHint', [outputDir]));
|
|
146
|
+
}
|
|
147
|
+
const humanReporter = new apex_node_1.HumanReporter();
|
|
148
|
+
const output = humanReporter.format(result, detailedCoverage);
|
|
149
|
+
this.ux.log(output);
|
|
150
|
+
}
|
|
151
|
+
logTap(result) {
|
|
152
|
+
const reporter = new apex_node_1.TapReporter();
|
|
153
|
+
const hint = this.formatReportHint(result);
|
|
154
|
+
this.ux.log(reporter.format(result, [hint]));
|
|
155
|
+
}
|
|
156
|
+
logJUnit(result) {
|
|
157
|
+
const reporter = new apex_node_1.JUnitReporter();
|
|
158
|
+
this.ux.log(reporter.format(result));
|
|
159
|
+
}
|
|
160
|
+
formatReportHint(result) {
|
|
161
|
+
let reportArgs = `-i ${result.summary.testRunId}`;
|
|
162
|
+
const username = this.connection?.getUsername();
|
|
163
|
+
if (username) {
|
|
164
|
+
reportArgs += ` -o ${username}`;
|
|
165
|
+
}
|
|
166
|
+
return messages.getMessage('apexTestReportFormatHint', [this.bin, reportArgs]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.TestReporter = TestReporter;
|
|
170
|
+
//# sourceMappingURL=testReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,qDAU+B;AAG/B,2CAAwD;AAExD,oCAA6C;AAC7C,iDAAyD;AAEzD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;AAE7E,MAAa,YAAY;IACvB;;;;;;OAMG;IACH,YAAoC,EAAM,EAAmB,UAAsB,EAAmB,GAAW;QAA7E,OAAE,GAAF,EAAE,CAAI;QAAmB,eAAU,GAAV,UAAU,CAAY;QAAmB,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAE9G,KAAK,CAAC,MAAM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"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -3,6 +3,4 @@ export declare const FAILURE_EXIT_CODE = 100;
|
|
|
3
3
|
export declare const colorSuccess: chalk.Chalk;
|
|
4
4
|
export declare const colorError: chalk.Chalk;
|
|
5
5
|
export declare const resultFormat: string[];
|
|
6
|
-
export declare const logLevels: string[];
|
|
7
|
-
export declare function buildDescription(shortDescription: string, longDescription: string): string;
|
|
8
6
|
export declare function colorLogs(log: string): string;
|
package/lib/utils.js
CHANGED
|
@@ -6,30 +6,12 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.colorLogs = exports.
|
|
9
|
+
exports.colorLogs = exports.resultFormat = exports.colorError = exports.colorSuccess = exports.FAILURE_EXIT_CODE = void 0;
|
|
10
10
|
const chalk = require("chalk");
|
|
11
11
|
exports.FAILURE_EXIT_CODE = 100;
|
|
12
12
|
exports.colorSuccess = chalk.bold.green;
|
|
13
13
|
exports.colorError = chalk.bold.red;
|
|
14
14
|
exports.resultFormat = ['human', 'tap', 'junit', 'json'];
|
|
15
|
-
exports.logLevels = [
|
|
16
|
-
'trace',
|
|
17
|
-
'debug',
|
|
18
|
-
'info',
|
|
19
|
-
'warn',
|
|
20
|
-
'error',
|
|
21
|
-
'fatal',
|
|
22
|
-
'TRACE',
|
|
23
|
-
'DEBUG',
|
|
24
|
-
'INFO',
|
|
25
|
-
'WARN',
|
|
26
|
-
'ERROR',
|
|
27
|
-
'FATAL',
|
|
28
|
-
];
|
|
29
|
-
function buildDescription(shortDescription, longDescription) {
|
|
30
|
-
return `${shortDescription}\n${longDescription}`;
|
|
31
|
-
}
|
|
32
|
-
exports.buildDescription = buildDescription;
|
|
33
15
|
const colorMap = new Map([
|
|
34
16
|
[new RegExp(/\b([\w]+\.)+(\w)+\b/g), chalk.blueBright],
|
|
35
17
|
[new RegExp(/\b(DEBUG)\b/g), chalk.bold.cyan],
|
|
@@ -45,8 +27,7 @@ function replace(regex, word) {
|
|
|
45
27
|
if (!color) {
|
|
46
28
|
throw new Error('Error retrieving colors');
|
|
47
29
|
}
|
|
48
|
-
|
|
49
|
-
return result;
|
|
30
|
+
return word.replace(regex, (match) => `${color(match)}`);
|
|
50
31
|
}
|
|
51
32
|
function colorLogs(log) {
|
|
52
33
|
for (const c of colorMap.keys()) {
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA+B;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA+B;AAClB,QAAA,iBAAiB,GAAG,GAAG,CAAC;AACxB,QAAA,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAChC,QAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;AAE5B,QAAA,YAAY,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE9D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,CAAC,IAAI,MAAM,CAAC,sBAAsB,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IACtD,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7C,CAAC,IAAI,MAAM,CAAC,8BAA8B,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IAC9D,CAAC,IAAI,MAAM,CAAC,qBAAqB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACtD,CAAC,IAAI,MAAM,CAAC,2BAA2B,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;IACzD,CAAC,IAAI,MAAM,CAAC,4BAA4B,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;IAC1D,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;IACxC,CAAC,IAAI,MAAM,CAAC,+BAA+B,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;CAChE,CAAC,CAAC;AAEH,SAAS,OAAO,CAAC,KAAa,EAAE,IAAY;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,SAAgB,SAAS,CAAC,GAAW;IACnC,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE;QAC/B,GAAG,GAAG,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;KACvB;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AALD,8BAKC"}
|
package/messages/get.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Fetch the specified log or given number of most recent logs from the org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
To get the IDs for your debug logs, run "<%= config.bin %> apex log list". Executing this command without flags returns the most recent log.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Fetch the log in your default org using an ID:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --log-id <log id>
|
|
14
|
+
|
|
15
|
+
- Fetch the log in the org with the specified username using an ID:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --log-id <log id> --target-org me@my.org
|
|
18
|
+
|
|
19
|
+
- Fetch the two most recent logs in your default org:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %> --number 2
|
|
22
|
+
|
|
23
|
+
- Similar to previous example, but save the two log files in the specified directory:
|
|
24
|
+
|
|
25
|
+
<%= config.bin %> <%= command.id %> --output-dir /Users/sfdxUser/logs --number 2
|
|
26
|
+
|
|
27
|
+
# flags.log-id.summary
|
|
28
|
+
|
|
29
|
+
ID of the specific log to display.
|
|
30
|
+
|
|
31
|
+
# flags.number.summary
|
|
32
|
+
|
|
33
|
+
Number of the most recent logs to display.
|
|
34
|
+
|
|
35
|
+
# flags.output-dir.summary
|
|
36
|
+
|
|
37
|
+
Directory for saving the log files.
|
|
38
|
+
|
|
39
|
+
# flags.output-dir.description
|
|
40
|
+
|
|
41
|
+
The location can be an absolute path or relative to the current working directory. The default is the current directory.
|
|
42
|
+
|
|
43
|
+
# noResultsFound
|
|
44
|
+
|
|
45
|
+
No results found
|
package/messages/list.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Display a list of IDs and general information about debug logs.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Run this command in a project to list the IDs and general information for all debug logs in your default org.
|
|
8
|
+
|
|
9
|
+
To fetch a specific log from your org, obtain the ID from this command's output, then run the “<%= config.bin %> apex log get” command.
|
|
10
|
+
|
|
11
|
+
# examples
|
|
12
|
+
|
|
13
|
+
- List the IDs and information about the debug logs in your default org:
|
|
14
|
+
|
|
15
|
+
<%= config.bin %> <%= command.id %>
|
|
16
|
+
|
|
17
|
+
- Similar to previous example, but use the org with the specified username:
|
|
18
|
+
|
|
19
|
+
<%= config.bin %> <%= command.id %> --target-org me@my.org
|
|
20
|
+
|
|
21
|
+
# noDebugLogsFound
|
|
22
|
+
|
|
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
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Display test results for a specific asynchronous test run.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Provide a test run ID to display test results for an enqueued or completed asynchronous test run. The test run ID is displayed after running the "<%= config.bin %> apex test run" command.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Display test results for your default org using a test run ID:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --test-run-id <test run id>
|
|
14
|
+
|
|
15
|
+
- Similar to previous example, but output the result in JUnit format:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --test-run-id <test run id> --result-format junit
|
|
18
|
+
|
|
19
|
+
- Also retrieve code coverage results and output in JSON format:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --json
|
|
22
|
+
|
|
23
|
+
- Specify a directory in which to save the test results from the org with the specified username (rather than your default org):
|
|
24
|
+
|
|
25
|
+
<%= config.bin %> <%= command.id %> --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg',
|
|
26
|
+
|
|
27
|
+
# flags.test-run-id.summary
|
|
28
|
+
|
|
29
|
+
ID of the test run.
|
|
30
|
+
|
|
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
|
+
# flags.output-dir.summary
|
|
40
|
+
|
|
41
|
+
Directory in which to store test result files.
|
|
42
|
+
|
|
43
|
+
# apexLibErr
|
|
44
|
+
|
|
45
|
+
Unknown error in Apex Library: %s
|
package/messages/run.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Execute anonymous Apex code entered on the command line or from a local file.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
If you don’t run this command from within a Salesforce DX project, you must specify the —-target-org flag.
|
|
8
|
+
|
|
9
|
+
To execute your code interactively, run this command with no flags. At the prompt, enter all your Apex code; press CTRL-D when you're finished. Your code is then executed in a single execute anonymous request.
|
|
10
|
+
For more information, see "Anonymous Blocks" in the Apex Developer Guide.
|
|
11
|
+
|
|
12
|
+
# flags.file
|
|
13
|
+
|
|
14
|
+
Path to a local file that contains Apex code.
|
|
15
|
+
|
|
16
|
+
# examples
|
|
17
|
+
|
|
18
|
+
- Execute the Apex code that's in the ~/test.apex file in the org with the specified username:
|
|
19
|
+
|
|
20
|
+
<%= config.bin %> <%= command.id %> --target-org testusername@salesforce.org --apex-code-file ~/test.apex
|
|
21
|
+
|
|
22
|
+
- Similar to previous example, but execute the code in your default org:
|
|
23
|
+
|
|
24
|
+
<%= config.bin %> <%= command.id %> --apex-code-file ~/test.apex
|
|
25
|
+
|
|
26
|
+
- Run the command with no flags to start interactive mode; the code will execute in your default org when you exit. At the prompt, start type Apex code and press the Enter key after each line. Press CTRL+D when finished.
|
|
27
|
+
|
|
28
|
+
<%= config.bin %> <%= command.id %>
|
|
29
|
+
|
|
30
|
+
# executeCompileSuccess
|
|
31
|
+
|
|
32
|
+
Compiled successfully.
|
|
33
|
+
|
|
34
|
+
# executeRuntimeSuccess
|
|
35
|
+
|
|
36
|
+
Executed successfully.
|
|
37
|
+
|
|
38
|
+
# executeRuntimeFailure
|
|
39
|
+
|
|
40
|
+
Execution failed.
|
|
41
|
+
|
|
42
|
+
# executeCompileFailure
|
|
43
|
+
|
|
44
|
+
Compilation failed.
|
|
45
|
+
|
|
46
|
+
# executeRuntimeSuccess
|
|
47
|
+
|
|
48
|
+
Executed successfully.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Invoke Apex tests in an org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Specify which tests to run by using the --class-names, --suite-names, or --tests flags. Alternatively, use the --test-level flag to run all the tests in your org, local tests, or specified tests.
|
|
8
|
+
To see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.
|
|
9
|
+
|
|
10
|
+
NOTE: The testRunCoverage value (JSON and JUnit result formats) is a percentage of the covered lines and total lines from all the Apex classes evaluated by the tests in this run.
|
|
11
|
+
|
|
12
|
+
# examples
|
|
13
|
+
|
|
14
|
+
- Run all Apex tests and suites in your default org:
|
|
15
|
+
|
|
16
|
+
<%= config.bin %> <%= command.id %>
|
|
17
|
+
|
|
18
|
+
- Run the specified Apex test classes in your default org and display results in human-readable form:
|
|
19
|
+
|
|
20
|
+
<%= config.bin %> <%= command.id %> --class-names "MyClassTest,MyOtherClassTest" --result-format human
|
|
21
|
+
|
|
22
|
+
- Run the specified Apex test suites in your default org and include code coverage results and additional details:
|
|
23
|
+
|
|
24
|
+
<%= config.bin %> <%= command.id %> --suite-names "MySuite,MyOtherSuite" --code-coverage --detailed-coverage
|
|
25
|
+
|
|
26
|
+
- Run the specified Apex tests in your default org and display results in human-readable output:
|
|
27
|
+
|
|
28
|
+
<%= config.bin %> <%= command.id %> --tests "MyClassTest.testCoolFeature,MyClassTest.testAwesomeFeature,AnotherClassTest,namespace.TheirClassTest.testThis" --result-format human
|
|
29
|
+
|
|
30
|
+
- Run all tests in the org with the specified username with the specified test level; save the output to the specified directory:
|
|
31
|
+
|
|
32
|
+
<%= config.bin %> <%= command.id %> --test-level RunLocalTests --output-dir <path to outputdir> --target-org me@my.org
|
|
33
|
+
|
|
34
|
+
# flags.result-format.summary
|
|
35
|
+
|
|
36
|
+
Format of the test results.
|
|
37
|
+
|
|
38
|
+
# flags.class-names.summary
|
|
39
|
+
|
|
40
|
+
Comma-separated list of Apex test class names to run; default is all classes.
|
|
41
|
+
|
|
42
|
+
# flags.class-names.description
|
|
43
|
+
|
|
44
|
+
If you select --class-names, you can't specify --suite-names or --tests.
|
|
45
|
+
|
|
46
|
+
# flags.suite-names.summary
|
|
47
|
+
|
|
48
|
+
Comma-separated list of Apex test suite names to run; default is all suites.
|
|
49
|
+
|
|
50
|
+
# flags.suite-names.description
|
|
51
|
+
|
|
52
|
+
If you select --suite-names, you can't specify --class-names or --tests.
|
|
53
|
+
|
|
54
|
+
# flags.tests.summary
|
|
55
|
+
|
|
56
|
+
Comma-separated list of Apex test class names or IDs and, if applicable, test methods to run; default is all tests.
|
|
57
|
+
|
|
58
|
+
# flags.tests.description
|
|
59
|
+
|
|
60
|
+
If you specify --tests, you can't specify --class-names or --suite-names
|
|
61
|
+
|
|
62
|
+
# flags.code-coverage.summary
|
|
63
|
+
|
|
64
|
+
Retrieve code coverage results.
|
|
65
|
+
|
|
66
|
+
# flags.output-dir.summary
|
|
67
|
+
|
|
68
|
+
Directory in which to store test run files.
|
|
69
|
+
|
|
70
|
+
# flags.test-level.summary
|
|
71
|
+
|
|
72
|
+
Level of tests to run; default is RunLocalTests.
|
|
73
|
+
|
|
74
|
+
# flags.test-level.description
|
|
75
|
+
|
|
76
|
+
Here's what the levels mean:
|
|
77
|
+
|
|
78
|
+
- RunSpecifiedTests — Only the tests that you specify are run.
|
|
79
|
+
- RunLocalTests — All tests in your org are run, except the ones that originate from installed managed packages.
|
|
80
|
+
- RunAllTestsInOrg — All tests are in your org and in installed managed packages are run
|
|
81
|
+
|
|
82
|
+
# flags.wait.summary
|
|
83
|
+
|
|
84
|
+
Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently.
|
|
85
|
+
|
|
86
|
+
# flags.synchronous.summary
|
|
87
|
+
|
|
88
|
+
Runs test methods from a single Apex class synchronously; if not specified, tests are run asynchronously.
|
|
89
|
+
|
|
90
|
+
# flags.detailed-coverage.summary
|
|
91
|
+
|
|
92
|
+
Display detailed code coverage per test.
|
|
93
|
+
|
|
94
|
+
# missingReporterErr
|
|
95
|
+
|
|
96
|
+
Select a result format when specifying code coverage
|
|
97
|
+
|
|
98
|
+
# runTestReportCommand
|
|
99
|
+
|
|
100
|
+
Run "%s apex get test -i %s -o %s" to retrieve test results
|
|
101
|
+
|
|
102
|
+
# classSuiteTestErr
|
|
103
|
+
|
|
104
|
+
Specify either classnames, suitenames, or tests
|
|
105
|
+
|
|
106
|
+
# syncClassErr
|
|
107
|
+
|
|
108
|
+
Synchronous test runs can include test methods from only one Apex class. Omit the --synchronous flag or include tests from only one class
|
|
109
|
+
|
|
110
|
+
# testLevelErr
|
|
111
|
+
|
|
112
|
+
When specifying classnames, suitenames, or tests, indicate RunSpecifiedTests as the testlevel
|
|
113
|
+
|
|
114
|
+
# testResultProcessErr
|
|
115
|
+
|
|
116
|
+
Encountered an error when processing test results
|
|
117
|
+
%s
|
|
118
|
+
|
|
119
|
+
# apexTestReportFormatHint
|
|
120
|
+
|
|
121
|
+
Run "%s apex get test %s --result-format <format>" to retrieve test results in a different format.
|
|
122
|
+
|
|
123
|
+
# outputDirHint
|
|
124
|
+
|
|
125
|
+
Test result files written to %s
|
|
126
|
+
|
|
127
|
+
# apexLibErr
|
|
128
|
+
|
|
129
|
+
Unknown error in Apex Library: %s
|
package/messages/tail.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Activate debug logging and display logs in the terminal.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
You can also pipe the logs to a file.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Activate debug logging:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %>
|
|
14
|
+
|
|
15
|
+
- Specify a debug level:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --debug-level MyDebugLevel
|
|
18
|
+
|
|
19
|
+
- Skip the trace flag setup and apply default colors:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %> --color --skip-trace-flag
|
|
22
|
+
|
|
23
|
+
# flags.color.summary
|
|
24
|
+
|
|
25
|
+
Apply default colors to noteworthy log lines.
|
|
26
|
+
|
|
27
|
+
# flags.debug-level.summary
|
|
28
|
+
|
|
29
|
+
Debug level to set on the DEVELOPER_LOG trace flag for your user.
|
|
30
|
+
|
|
31
|
+
# flags.skip-trace-flag.summary
|
|
32
|
+
|
|
33
|
+
Skip trace flag setup. Assumes that a trace flag and debug level are fully set up.
|
|
34
|
+
|
|
35
|
+
# finishedTailing
|
|
36
|
+
|
|
37
|
+
Finished tailing logs
|