@salesforce/plugin-apex 2.3.20 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -55
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +8 -0
- package/bin/run.js +9 -0
- package/lib/commands/apex/get/log.d.ts +6 -6
- package/lib/commands/apex/get/log.js +45 -46
- package/lib/commands/apex/get/log.js.map +1 -1
- package/lib/commands/apex/get/test.d.ts +8 -8
- package/lib/commands/apex/get/test.js +51 -52
- package/lib/commands/apex/get/test.js.map +1 -1
- package/lib/commands/apex/list/log.d.ts +3 -3
- package/lib/commands/apex/list/log.js +19 -20
- package/lib/commands/apex/list/log.js.map +1 -1
- package/lib/commands/apex/run/test.d.ts +14 -14
- package/lib/commands/apex/run/test.js +99 -102
- package/lib/commands/apex/run/test.js.map +1 -1
- package/lib/commands/apex/run.d.ts +4 -4
- package/lib/commands/apex/run.js +30 -31
- package/lib/commands/apex/run.js.map +1 -1
- package/lib/commands/apex/tail/log.d.ts +6 -6
- package/lib/commands/apex/tail/log.js +39 -39
- package/lib/commands/apex/tail/log.js.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/legacyColorization.js +9 -11
- package/lib/legacyColorization.js.map +1 -1
- package/lib/reporters/index.d.ts +2 -2
- package/lib/reporters/index.js +2 -7
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/jsonReporter.d.ts +1 -1
- package/lib/reporters/jsonReporter.js +1 -5
- package/lib/reporters/jsonReporter.js.map +1 -1
- package/lib/reporters/runReporter.d.ts +1 -1
- package/lib/reporters/runReporter.js +11 -12
- package/lib/reporters/runReporter.js.map +1 -1
- package/lib/reporters/testReporter.d.ts +1 -1
- package/lib/reporters/testReporter.js +28 -27
- package/lib/reporters/testReporter.js.map +1 -1
- package/lib/utils.d.ts +2 -3
- package/lib/utils.js +6 -10
- package/lib/utils.js.map +1 -1
- package/oclif.lock +8037 -0
- package/oclif.manifest.json +594 -325
- package/package.json +38 -57
- package/bin/dev +0 -21
- package/bin/run +0 -5
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { LogService } from '@salesforce/apex-node';
|
|
10
|
+
import { Flags, SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, loglevel, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages } from '@salesforce/core';
|
|
12
|
+
import { colorizeLog } from '../../../legacyColorization.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'tail');
|
|
15
|
+
export default class Log extends SfCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
19
|
+
static deprecateAliases = true;
|
|
20
|
+
static aliases = ['force:apex:log:tail'];
|
|
21
|
+
static flags = {
|
|
22
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
23
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
24
|
+
loglevel,
|
|
25
|
+
color: Flags.boolean({
|
|
26
|
+
char: 'c',
|
|
27
|
+
summary: messages.getMessage('flags.color.summary'),
|
|
28
|
+
}),
|
|
29
|
+
'debug-level': Flags.string({
|
|
30
|
+
deprecateAliases: true,
|
|
31
|
+
aliases: ['debuglevel'],
|
|
32
|
+
char: 'd',
|
|
33
|
+
summary: messages.getMessage('flags.debug-level.summary'),
|
|
34
|
+
exclusive: ['skip-trace-flag'],
|
|
35
|
+
}),
|
|
36
|
+
'skip-trace-flag': Flags.boolean({
|
|
37
|
+
deprecateAliases: true,
|
|
38
|
+
aliases: ['skiptraceflag'],
|
|
39
|
+
char: 's',
|
|
40
|
+
summary: messages.getMessage('flags.skip-trace-flag.summary'),
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
color;
|
|
16
44
|
async run() {
|
|
17
45
|
const { flags } = await this.parse(Log);
|
|
18
46
|
this.color = flags.color;
|
|
@@ -34,7 +62,7 @@ class Log extends sf_plugins_core_1.SfCommand {
|
|
|
34
62
|
});
|
|
35
63
|
}
|
|
36
64
|
else {
|
|
37
|
-
const output = this.color ? await
|
|
65
|
+
const output = this.color ? await colorizeLog(fullLog) : fullLog;
|
|
38
66
|
this.log(output);
|
|
39
67
|
}
|
|
40
68
|
}
|
|
@@ -47,35 +75,7 @@ class Log extends sf_plugins_core_1.SfCommand {
|
|
|
47
75
|
*/
|
|
48
76
|
// eslint-disable-next-line class-methods-use-this
|
|
49
77
|
getLogService(conn) {
|
|
50
|
-
return new
|
|
78
|
+
return new LogService(conn);
|
|
51
79
|
}
|
|
52
80
|
}
|
|
53
|
-
exports.default = Log;
|
|
54
|
-
Log.summary = messages.getMessage('summary');
|
|
55
|
-
Log.description = messages.getMessage('description');
|
|
56
|
-
Log.examples = messages.getMessages('examples');
|
|
57
|
-
Log.deprecateAliases = true;
|
|
58
|
-
Log.aliases = ['force:apex:log:tail'];
|
|
59
|
-
Log.flags = {
|
|
60
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
61
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
62
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
63
|
-
color: sf_plugins_core_1.Flags.boolean({
|
|
64
|
-
char: 'c',
|
|
65
|
-
summary: messages.getMessage('flags.color.summary'),
|
|
66
|
-
}),
|
|
67
|
-
'debug-level': sf_plugins_core_1.Flags.string({
|
|
68
|
-
deprecateAliases: true,
|
|
69
|
-
aliases: ['debuglevel'],
|
|
70
|
-
char: 'd',
|
|
71
|
-
summary: messages.getMessage('flags.debug-level.summary'),
|
|
72
|
-
exclusive: ['skip-trace-flag'],
|
|
73
|
-
}),
|
|
74
|
-
'skip-trace-flag': sf_plugins_core_1.Flags.boolean({
|
|
75
|
-
deprecateAliases: true,
|
|
76
|
-
aliases: ['skiptraceflag'],
|
|
77
|
-
char: 's',
|
|
78
|
-
summary: messages.getMessage('flags.skip-trace-flag.summary'),
|
|
79
|
-
}),
|
|
80
|
-
};
|
|
81
81
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/tail/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/tail/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,EACjC,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAA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
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
7
|
+
export default {};
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAe,EAAE,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import convert from 'color-convert';
|
|
10
|
+
import { Logger } from '@salesforce/core';
|
|
12
11
|
const DEFAULT_COLOR_MAP = {
|
|
13
12
|
CONSTRUCTOR_: 'magenta',
|
|
14
13
|
EXCEPTION_: 'red',
|
|
@@ -23,14 +22,13 @@ const DEFAULT_COLOR_MAP = {
|
|
|
23
22
|
* @param log - full debug log retrieved from an org.
|
|
24
23
|
* @returns colorized log
|
|
25
24
|
*/
|
|
26
|
-
async function colorizeLog(log) {
|
|
27
|
-
const logger = await
|
|
25
|
+
export async function colorizeLog(log) {
|
|
26
|
+
const logger = await Logger.child('apexLogApi', { tag: 'tail' });
|
|
28
27
|
let colorMap = DEFAULT_COLOR_MAP;
|
|
29
28
|
const localColorMapFile = process.env.SFDX_APEX_LOG_COLOR_MAP;
|
|
30
29
|
if (localColorMapFile) {
|
|
31
30
|
try {
|
|
32
|
-
|
|
33
|
-
colorMap = require(localColorMapFile);
|
|
31
|
+
colorMap = JSON.parse(await readFile(localColorMapFile, 'utf-8'));
|
|
34
32
|
}
|
|
35
33
|
catch (err) {
|
|
36
34
|
logger.warn(`Color registry not found: ${localColorMapFile}`);
|
|
@@ -47,7 +45,8 @@ async function colorizeLog(log) {
|
|
|
47
45
|
...logLines.map((logLine) => {
|
|
48
46
|
for (const [key, color] of Object.entries(colorMap)) {
|
|
49
47
|
if (logLine.includes(`|${key}`)) {
|
|
50
|
-
const
|
|
48
|
+
const hex = convert.keyword.hex(color);
|
|
49
|
+
const colorFn = chalk.hex(hex);
|
|
51
50
|
if (typeof colorFn !== 'function') {
|
|
52
51
|
logger.warn(`Color ${color} is not supported`);
|
|
53
52
|
return logLine;
|
|
@@ -64,5 +63,4 @@ async function colorizeLog(log) {
|
|
|
64
63
|
}),
|
|
65
64
|
].join('\n');
|
|
66
65
|
}
|
|
67
|
-
exports.colorizeLog = colorizeLog;
|
|
68
66
|
//# sourceMappingURL=legacyColorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyColorization.js","sourceRoot":"","sources":["../src/legacyColorization.ts"],"names":[],"mappings":"
|
|
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,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CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACvC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBAE/B,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,mBAAmB,CAAC,CAAC;wBAC/C,OAAO,OAAO,CAAC;qBAChB;oBAED,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;oBAClD,IAAI,KAAK,KAAK,CAAC,EAAE;wBACf,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;qBACzB;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;iBAC7E;aACF;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/lib/reporters/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { JsonReporter, RunResult } from './jsonReporter';
|
|
2
|
-
export { TestReporter } from './testReporter';
|
|
1
|
+
export { JsonReporter, RunResult } from './jsonReporter.js';
|
|
2
|
+
export { TestReporter } from './testReporter.js';
|
package/lib/reporters/index.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestReporter = exports.JsonReporter = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
3
|
* All rights reserved.
|
|
7
4
|
* Licensed under the BSD 3-Clause license.
|
|
8
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var testReporter_1 = require("./testReporter");
|
|
13
|
-
Object.defineProperty(exports, "TestReporter", { enumerable: true, get: function () { return testReporter_1.TestReporter; } });
|
|
7
|
+
export { JsonReporter } from './jsonReporter.js';
|
|
8
|
+
export { TestReporter } from './testReporter.js';
|
|
14
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAa,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApexTestResultOutcome, TestResult } from '@salesforce/apex-node';
|
|
2
|
-
import { ApexTestRunResultStatus } from '@salesforce/apex-node/lib/src/tests/types';
|
|
2
|
+
import { ApexTestRunResultStatus } from '@salesforce/apex-node/lib/src/tests/types.js';
|
|
3
3
|
export type RunResult = {
|
|
4
4
|
summary: Summary;
|
|
5
5
|
tests: CliTestResult[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonReporter = void 0;
|
|
4
1
|
const skippedProperties = ['skipRate', 'coveredLines', 'totalLines'];
|
|
5
2
|
const timeProperties = ['testExecutionTimeInMs', 'testTotalTimeInMs', 'commandTimeInMs'];
|
|
6
|
-
class JsonReporter {
|
|
3
|
+
export class JsonReporter {
|
|
7
4
|
format(result) {
|
|
8
5
|
return {
|
|
9
6
|
summary: this.formatSummary(result),
|
|
@@ -96,5 +93,4 @@ class JsonReporter {
|
|
|
96
93
|
return formattedCov;
|
|
97
94
|
}
|
|
98
95
|
}
|
|
99
|
-
exports.JsonReporter = JsonReporter;
|
|
100
96
|
//# sourceMappingURL=jsonReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonReporter.js","sourceRoot":"","sources":["../../src/reporters/jsonReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsonReporter.js","sourceRoot":"","sources":["../../src/reporters/jsonReporter.ts"],"names":[],"mappings":"AAoFA,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AACrE,MAAM,cAAc,GAAG,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAEzF,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,MAAkB;QAC9B,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YACnC,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC,YAAY;gBACrB,CAAC,CAAC;oBACE,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;iBACtC;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;IAED,kDAAkD;IAC1C,aAAa,CAAC,UAAsB;QAC1C,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC1D,IAAI,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACnC,OAAO;aACR;YAED,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,E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AAC,CAAC,CAAC,EAAE,CAAC;4BACnE,cAAc,EAAE,IAAI,CAAC,UAAU;4BAC/B,eAAe,EAAE,WAAW,CAAC,eAAe;4BAC5C,kBAAkB,EAAE;gCAClB,EAAE,EAAE,WAAW,CAAC,oBAAoB;gCACpC,IAAI,EAAE,WAAW,CAAC,sBAAsB;6BACzC;4BACD,iBAAiB,EAAE,WAAW,CAAC,iBAAiB;yBAC7B,CAAC,CAAC;oBACzB,CAAC,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecuteAnonymousResponse } from '@salesforce/apex-node';
|
|
2
|
-
import { ExecuteResult } from '../commands/apex/run';
|
|
2
|
+
import { ExecuteResult } from '../commands/apex/run.js';
|
|
3
3
|
export default class RunReporter {
|
|
4
4
|
static formatDefault(response: ExecuteAnonymousResponse): string;
|
|
5
5
|
static formatJson(response: ExecuteAnonymousResponse): ExecuteResult;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
import { colorError, colorSuccess } from '../utils.js';
|
|
12
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'run');
|
|
14
|
+
export default class RunReporter {
|
|
15
15
|
static formatDefault(response) {
|
|
16
16
|
const outputText = [];
|
|
17
17
|
if (response.success) {
|
|
18
|
-
outputText.push(
|
|
18
|
+
outputText.push(colorSuccess(messages.getMessage('executeCompileSuccess')), colorSuccess(messages.getMessage('executeRuntimeSuccess')), '', response.logs ?? '');
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
if (!response.diagnostic) {
|
|
@@ -23,10 +23,10 @@ class RunReporter {
|
|
|
23
23
|
}
|
|
24
24
|
const diagnostic = response.diagnostic[0];
|
|
25
25
|
if (!response.compiled) {
|
|
26
|
-
outputText.push(
|
|
26
|
+
outputText.push(colorError(`Error: Line: ${diagnostic.lineNumber}, Column: ${diagnostic.columnNumber}`), colorError(`Error: ${diagnostic.compileProblem}\n`));
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
outputText.push(
|
|
29
|
+
outputText.push(colorSuccess(messages.getMessage('executeCompileSuccess')), colorError(`Error: ${diagnostic.exceptionMessage}`), colorError(`Error: ${diagnostic.exceptionStackTrace}`), '', response.logs ?? '');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
return outputText.join(os.EOL);
|
|
@@ -44,5 +44,4 @@ class RunReporter {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
exports.default = RunReporter;
|
|
48
47
|
//# sourceMappingURL=runReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAA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,CAAC,EACnD,UAAU,CAAC,UAAU,UAAU,CAAC,mBAAmB,EAAE,CAAC,EACtD,EAAE,EACF,QAAQ,CAAC,IAAI,IAAI,EAAE,CACpB,CAAC;aACH;SACF;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"}
|
|
@@ -2,7 +2,7 @@ import { TestResult } from '@salesforce/apex-node';
|
|
|
2
2
|
import { Ux } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { Connection } from '@salesforce/core';
|
|
4
4
|
import { Duration } from '@salesforce/kit';
|
|
5
|
-
import { RunResult } from './jsonReporter';
|
|
5
|
+
import { RunResult } from './jsonReporter.js';
|
|
6
6
|
export declare class TestReporter {
|
|
7
7
|
private readonly ux;
|
|
8
8
|
private readonly connection;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestReporter = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
3
|
* All rights reserved.
|
|
7
4
|
* Licensed under the BSD 3-Clause license.
|
|
8
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { HumanReporter, JUnitReporter, ResultFormat, TapReporter, TestService, } from '@salesforce/apex-node';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
import { FAILURE_EXIT_CODE } from '../utils.js';
|
|
12
|
+
import { JsonReporter } from './jsonReporter.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtest');
|
|
15
|
+
export class TestReporter {
|
|
16
|
+
ux;
|
|
17
|
+
connection;
|
|
18
|
+
bin;
|
|
17
19
|
/**
|
|
18
20
|
* Create a TestReporter that will format test results
|
|
19
21
|
*
|
|
@@ -30,12 +32,12 @@ class TestReporter {
|
|
|
30
32
|
if (options['output-dir']) {
|
|
31
33
|
const jsonOutput = this.formatResultInJson(result);
|
|
32
34
|
const outputDirConfig = this.buildOutputDirConfig(result, jsonOutput, options['output-dir'], options['result-format'], Boolean(options['detailed-coverage']), options.synchronous);
|
|
33
|
-
const testService = new
|
|
35
|
+
const testService = new TestService(this.connection);
|
|
34
36
|
await testService.writeResultFiles(result, outputDirConfig, options['code-coverage']);
|
|
35
37
|
}
|
|
36
38
|
try {
|
|
37
|
-
if (result.summary && result.summary.outcome ===
|
|
38
|
-
process.exitCode =
|
|
39
|
+
if (result.summary && result.summary.outcome === 'Failed') {
|
|
40
|
+
process.exitCode = FAILURE_EXIT_CODE;
|
|
39
41
|
}
|
|
40
42
|
switch (options['result-format']) {
|
|
41
43
|
case 'human':
|
|
@@ -99,29 +101,29 @@ class TestReporter {
|
|
|
99
101
|
]
|
|
100
102
|
: []),
|
|
101
103
|
];
|
|
102
|
-
outputDirConfig.resultFormats = [
|
|
104
|
+
outputDirConfig.resultFormats = [ResultFormat.junit];
|
|
103
105
|
}
|
|
104
106
|
if (typeof resultFormat === 'undefined' && synchronous) {
|
|
105
|
-
resultFormat =
|
|
107
|
+
resultFormat = ResultFormat.human;
|
|
106
108
|
}
|
|
107
109
|
switch (resultFormat) {
|
|
108
|
-
case
|
|
110
|
+
case ResultFormat.tap:
|
|
109
111
|
outputDirConfig.fileInfos?.push({
|
|
110
112
|
filename: 'test-result.txt',
|
|
111
|
-
content: new
|
|
113
|
+
content: new TapReporter().format(result),
|
|
112
114
|
});
|
|
113
|
-
outputDirConfig.resultFormats?.push(
|
|
115
|
+
outputDirConfig.resultFormats?.push(ResultFormat.tap);
|
|
114
116
|
break;
|
|
115
|
-
case
|
|
117
|
+
case ResultFormat.junit:
|
|
116
118
|
outputDirConfig.fileInfos?.push({
|
|
117
119
|
filename: 'test-result.xml',
|
|
118
|
-
content: new
|
|
120
|
+
content: new JUnitReporter().format(result),
|
|
119
121
|
});
|
|
120
122
|
break;
|
|
121
|
-
case
|
|
123
|
+
case ResultFormat.human:
|
|
122
124
|
outputDirConfig.fileInfos?.push({
|
|
123
125
|
filename: 'test-result.txt',
|
|
124
|
-
content: new
|
|
126
|
+
content: new HumanReporter().format(result, detailedCoverage),
|
|
125
127
|
});
|
|
126
128
|
break;
|
|
127
129
|
default:
|
|
@@ -132,7 +134,7 @@ class TestReporter {
|
|
|
132
134
|
}
|
|
133
135
|
formatResultInJson(result) {
|
|
134
136
|
try {
|
|
135
|
-
const reporter = new
|
|
137
|
+
const reporter = new JsonReporter();
|
|
136
138
|
return reporter.format(result);
|
|
137
139
|
}
|
|
138
140
|
catch (e) {
|
|
@@ -144,17 +146,17 @@ class TestReporter {
|
|
|
144
146
|
if (outputDir) {
|
|
145
147
|
this.ux.log(messages.getMessage('outputDirHint', [outputDir]));
|
|
146
148
|
}
|
|
147
|
-
const humanReporter = new
|
|
149
|
+
const humanReporter = new HumanReporter();
|
|
148
150
|
const output = humanReporter.format(result, detailedCoverage);
|
|
149
151
|
this.ux.log(output);
|
|
150
152
|
}
|
|
151
153
|
logTap(result) {
|
|
152
|
-
const reporter = new
|
|
154
|
+
const reporter = new TapReporter();
|
|
153
155
|
const hint = this.formatReportHint(result);
|
|
154
156
|
this.ux.log(reporter.format(result, [hint]));
|
|
155
157
|
}
|
|
156
158
|
logJUnit(result) {
|
|
157
|
-
const reporter = new
|
|
159
|
+
const reporter = new JUnitReporter();
|
|
158
160
|
this.ux.log(reporter.format(result));
|
|
159
161
|
}
|
|
160
162
|
formatReportHint(result) {
|
|
@@ -166,5 +168,4 @@ class TestReporter {
|
|
|
166
168
|
return messages.getMessage('apexTestReportFormatHint', [this.bin, reportArgs]);
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
|
-
exports.TestReporter = TestReporter;
|
|
170
171
|
//# sourceMappingURL=testReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,aAAa,EACb,aAAa,EAEb,YAAY,EACZ,WAAW,EAGX,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAA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AI,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;YACZ,UAAU,IAAI,OAAO,QAAQ,EAAE,CAAC;SACjC;QACD,OAAO,QAAQ,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IACjF,CAAC;CACF"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as chalk from 'chalk';
|
|
2
1
|
export declare const FAILURE_EXIT_CODE = 100;
|
|
3
|
-
export declare const colorSuccess: chalk.
|
|
4
|
-
export declare const colorError: chalk.
|
|
2
|
+
export declare const colorSuccess: import("chalk").ChalkInstance;
|
|
3
|
+
export declare const colorError: import("chalk").ChalkInstance;
|
|
5
4
|
export declare const resultFormat: string[];
|
|
6
5
|
export declare function colorLogs(log: string): string;
|
package/lib/utils.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.colorError = chalk.bold.red;
|
|
14
|
-
exports.resultFormat = ['human', 'tap', 'junit', 'json'];
|
|
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'];
|
|
15
12
|
const colorMap = new Map([
|
|
16
13
|
[new RegExp(/\b([\w]+\.)+(\w)+\b/g), chalk.blueBright],
|
|
17
14
|
[new RegExp(/\b(DEBUG)\b/g), chalk.bold.cyan],
|
|
@@ -29,11 +26,10 @@ function replace(regex, word) {
|
|
|
29
26
|
}
|
|
30
27
|
return word.replace(regex, (match) => `${color(match)}`);
|
|
31
28
|
}
|
|
32
|
-
function colorLogs(log) {
|
|
29
|
+
export function colorLogs(log) {
|
|
33
30
|
for (const c of colorMap.keys()) {
|
|
34
31
|
log = replace(c, log);
|
|
35
32
|
}
|
|
36
33
|
return log;
|
|
37
34
|
}
|
|
38
|
-
exports.colorLogs = colorLogs;
|
|
39
35
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
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,MAAM,CAAC,CAAC;AAE9D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,CAAC,IAAI,MAAM,CAAC,sBA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