@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/get/test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,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;AAC5C,OAAO,EAAa,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,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,EAAE,QAAQ,CAAC,CAAC;AAC5E,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAoB;IAC7C,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,OAAO,GAAG,CAAC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AAG,EAAE,EAAE;YACtC,MAAM,QAAQ,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAErE,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;QAElG,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE1G,OAAO,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE;YACjC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;YACjC,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC;YACvC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC;SACxC,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -8,9 +8,9 @@ export default class Log extends SfCommand<LogListResult> {
|
|
|
8
8
|
static readonly deprecateAliases = true;
|
|
9
9
|
static readonly aliases: string[];
|
|
10
10
|
static readonly flags: {
|
|
11
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<LogListResult>;
|
|
16
16
|
private formatTime;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { LogService } from '@salesforce/apex-node';
|
|
10
|
+
import { SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, loglevel, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages } from '@salesforce/core';
|
|
12
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'list');
|
|
14
|
+
export default class Log extends SfCommand {
|
|
15
|
+
static summary = messages.getMessage('summary');
|
|
16
|
+
static description = messages.getMessage('description');
|
|
17
|
+
static examples = messages.getMessages('examples');
|
|
18
|
+
static deprecateAliases = true;
|
|
19
|
+
static aliases = ['force:apex:log:list'];
|
|
20
|
+
static flags = {
|
|
21
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
22
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
23
|
+
loglevel,
|
|
24
|
+
};
|
|
15
25
|
async run() {
|
|
16
26
|
const { flags } = await this.parse(Log);
|
|
17
27
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
18
|
-
const logService = new
|
|
28
|
+
const logService = new LogService(conn);
|
|
19
29
|
const logRecords = await logService.getLogRecords();
|
|
20
30
|
if (logRecords.length === 0) {
|
|
21
31
|
this.log(messages.getMessage('noDebugLogsFound'));
|
|
@@ -62,15 +72,4 @@ class Log extends sf_plugins_core_1.SfCommand {
|
|
|
62
72
|
return time;
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
|
-
exports.default = Log;
|
|
66
|
-
Log.summary = messages.getMessage('summary');
|
|
67
|
-
Log.description = messages.getMessage('description');
|
|
68
|
-
Log.examples = messages.getMessages('examples');
|
|
69
|
-
Log.deprecateAliases = true;
|
|
70
|
-
Log.aliases = ['force:apex:log:list'];
|
|
71
|
-
Log.flags = {
|
|
72
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
73
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
74
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
75
|
-
};
|
|
76
75
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/list/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/commands/apex/list/log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAa,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,SAAS,EAC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AQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;gBACtD,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;gBACtD,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;gBAChE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE;gBAC5D,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;gBACtD,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;aAC3D,EACD,EAAE,aAAa,EAAE,IAAI,EAAE,CACxB,CAAC;SACH;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,kDAAkD;IAC1C,UAAU,CAAC,IAAY;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC;IACd,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CancellationTokenSource, TestRunIdResult } from '@salesforce/apex-node';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { Duration } from '@salesforce/kit';
|
|
4
|
-
import { RunResult } from '../../../reporters';
|
|
4
|
+
import { RunResult } from '../../../reporters/index.js';
|
|
5
5
|
export declare const TestLevelValues: string[];
|
|
6
6
|
export type RunCommandResult = RunResult | TestRunIdResult;
|
|
7
7
|
export default class Test extends SfCommand<RunCommandResult> {
|
|
@@ -11,19 +11,19 @@ export default class Test extends SfCommand<RunCommandResult> {
|
|
|
11
11
|
static readonly deprecateAliases = true;
|
|
12
12
|
static readonly aliases: string[];
|
|
13
13
|
static readonly flags: {
|
|
14
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
-
'code-coverage': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
-
'output-dir': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
|
-
'test-level': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
-
'class-names': import("@oclif/core/lib/interfaces").OptionFlag<string[]
|
|
21
|
-
'result-format': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
|
-
'suite-names': import("@oclif/core/lib/interfaces").OptionFlag<string[]
|
|
23
|
-
tests: import("@oclif/core/lib/interfaces").OptionFlag<string[]
|
|
24
|
-
wait: import("@oclif/core/lib/interfaces").OptionFlag<Duration
|
|
25
|
-
synchronous: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
|
-
'detailed-coverage': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
|
+
'code-coverage': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
18
|
+
'output-dir': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
19
|
+
'test-level': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
20
|
+
'class-names': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
|
+
'result-format': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
22
|
+
'suite-names': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
23
|
+
tests: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
24
|
+
wait: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<Duration, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
25
|
+
synchronous: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
26
|
+
'detailed-coverage': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
27
27
|
};
|
|
28
28
|
protected cancellationTokenSource: CancellationTokenSource;
|
|
29
29
|
run(): Promise<RunCommandResult>;
|
|
@@ -1,26 +1,101 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestLevelValues = 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
|
-
|
|
17
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { CancellationTokenSource, TestService } from '@salesforce/apex-node';
|
|
10
|
+
import { arrayWithDeprecation, Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, Ux, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
12
|
+
import { TestReporter } from '../../../reporters/index.js';
|
|
13
|
+
import { resultFormat } from '../../../utils.js';
|
|
14
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
15
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtest');
|
|
16
|
+
export const TestLevelValues = ['RunLocalTests', 'RunAllTestsInOrg', 'RunSpecifiedTests'];
|
|
18
17
|
const exclusiveTestSpecifiers = ['class-names', 'suite-names', 'tests'];
|
|
19
|
-
class Test extends
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export default class Test extends SfCommand {
|
|
19
|
+
static summary = messages.getMessage('summary');
|
|
20
|
+
static description = messages.getMessage('description');
|
|
21
|
+
static examples = messages.getMessages('examples');
|
|
22
|
+
static deprecateAliases = true;
|
|
23
|
+
static aliases = ['force:apex:test:run'];
|
|
24
|
+
static flags = {
|
|
25
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
26
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
27
|
+
loglevel,
|
|
28
|
+
'code-coverage': Flags.boolean({
|
|
29
|
+
aliases: ['codecoverage'],
|
|
30
|
+
deprecateAliases: true,
|
|
31
|
+
char: 'c',
|
|
32
|
+
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
33
|
+
}),
|
|
34
|
+
'output-dir': Flags.directory({
|
|
35
|
+
aliases: ['outputdir', 'output-directory'],
|
|
36
|
+
deprecateAliases: true,
|
|
37
|
+
char: 'd',
|
|
38
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
39
|
+
}),
|
|
40
|
+
'test-level': Flags.string({
|
|
41
|
+
deprecateAliases: true,
|
|
42
|
+
aliases: ['testlevel'],
|
|
43
|
+
char: 'l',
|
|
44
|
+
summary: messages.getMessage('flags.test-level.summary'),
|
|
45
|
+
description: messages.getMessage('flags.test-level.description'),
|
|
46
|
+
options: TestLevelValues,
|
|
47
|
+
}),
|
|
48
|
+
'class-names': arrayWithDeprecation({
|
|
49
|
+
deprecateAliases: true,
|
|
50
|
+
aliases: ['classnames'],
|
|
51
|
+
char: 'n',
|
|
52
|
+
summary: messages.getMessage('flags.class-names.summary'),
|
|
53
|
+
description: messages.getMessage('flags.class-names.description'),
|
|
54
|
+
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'class-names'),
|
|
55
|
+
}),
|
|
56
|
+
'result-format': Flags.string({
|
|
57
|
+
deprecateAliases: true,
|
|
58
|
+
aliases: ['resultformat'],
|
|
59
|
+
char: 'r',
|
|
60
|
+
summary: messages.getMessage('flags.result-format.summary'),
|
|
61
|
+
options: resultFormat,
|
|
62
|
+
default: 'human',
|
|
63
|
+
}),
|
|
64
|
+
'suite-names': arrayWithDeprecation({
|
|
65
|
+
deprecateAliases: true,
|
|
66
|
+
aliases: ['suitenames'],
|
|
67
|
+
char: 's',
|
|
68
|
+
summary: messages.getMessage('flags.suite-names.summary'),
|
|
69
|
+
description: messages.getMessage('flags.suite-names.description'),
|
|
70
|
+
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'suite-names'),
|
|
71
|
+
}),
|
|
72
|
+
tests: arrayWithDeprecation({
|
|
73
|
+
char: 't',
|
|
74
|
+
summary: messages.getMessage('flags.tests.summary'),
|
|
75
|
+
description: messages.getMessage('flags.tests.description'),
|
|
76
|
+
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'tests'),
|
|
77
|
+
}),
|
|
78
|
+
// we want to pass `undefined` to the API
|
|
79
|
+
// eslint-disable-next-line sf-plugin/flag-min-max-default
|
|
80
|
+
wait: Flags.duration({
|
|
81
|
+
unit: 'minutes',
|
|
82
|
+
char: 'w',
|
|
83
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
84
|
+
min: 0,
|
|
85
|
+
}),
|
|
86
|
+
synchronous: Flags.boolean({
|
|
87
|
+
char: 'y',
|
|
88
|
+
summary: messages.getMessage('flags.synchronous.summary'),
|
|
89
|
+
}),
|
|
90
|
+
'detailed-coverage': Flags.boolean({
|
|
91
|
+
deprecateAliases: true,
|
|
92
|
+
aliases: ['detailedcoverage'],
|
|
93
|
+
char: 'v',
|
|
94
|
+
summary: messages.getMessage('flags.detailed-coverage.summary'),
|
|
95
|
+
dependsOn: ['code-coverage'],
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
cancellationTokenSource = new CancellationTokenSource();
|
|
24
99
|
async run() {
|
|
25
100
|
const { flags } = await this.parse(Test);
|
|
26
101
|
const testLevel = await validateFlags(flags['class-names'], flags['suite-names'], flags.tests, flags.synchronous, flags['test-level']);
|
|
@@ -38,7 +113,7 @@ class Test extends sf_plugins_core_1.SfCommand {
|
|
|
38
113
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
39
114
|
process.on('SIGTERM', exitHandler);
|
|
40
115
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
41
|
-
const testService = new
|
|
116
|
+
const testService = new TestService(conn);
|
|
42
117
|
// NOTE: This is a *bug*. Synchronous test runs should throw an error when multiple test classes are specified
|
|
43
118
|
// This was re-introduced due to https://github.com/forcedotcom/salesforcedx-vscode/issues/3154
|
|
44
119
|
// Address with W-9163533
|
|
@@ -46,10 +121,10 @@ class Test extends sf_plugins_core_1.SfCommand {
|
|
|
46
121
|
? await this.runTest(testService, flags, testLevel)
|
|
47
122
|
: await this.runTestAsynchronous(testService, flags, testLevel);
|
|
48
123
|
if (this.cancellationTokenSource.token.isCancellationRequested) {
|
|
49
|
-
throw new
|
|
124
|
+
throw new SfError('Cancelled');
|
|
50
125
|
}
|
|
51
126
|
if ('summary' in result) {
|
|
52
|
-
const testReporter = new
|
|
127
|
+
const testReporter = new TestReporter(new Ux({ jsonEnabled: this.jsonEnabled() }), conn, this.config.bin);
|
|
53
128
|
return testReporter.report(result, flags);
|
|
54
129
|
}
|
|
55
130
|
else {
|
|
@@ -81,98 +156,20 @@ class Test extends sf_plugins_core_1.SfCommand {
|
|
|
81
156
|
return testService.runTestAsynchronous(payload, flags['code-coverage'], flags.wait && flags.wait.minutes > 0 ? false : !(flags.synchronous && !this.jsonEnabled()), undefined, this.cancellationTokenSource.token);
|
|
82
157
|
}
|
|
83
158
|
}
|
|
84
|
-
exports.default = Test;
|
|
85
|
-
Test.summary = messages.getMessage('summary');
|
|
86
|
-
Test.description = messages.getMessage('description');
|
|
87
|
-
Test.examples = messages.getMessages('examples');
|
|
88
|
-
Test.deprecateAliases = true;
|
|
89
|
-
Test.aliases = ['force:apex:test:run'];
|
|
90
|
-
Test.flags = {
|
|
91
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
92
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
93
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
94
|
-
'code-coverage': sf_plugins_core_1.Flags.boolean({
|
|
95
|
-
aliases: ['codecoverage'],
|
|
96
|
-
deprecateAliases: true,
|
|
97
|
-
char: 'c',
|
|
98
|
-
summary: messages.getMessage('flags.code-coverage.summary'),
|
|
99
|
-
}),
|
|
100
|
-
'output-dir': sf_plugins_core_1.Flags.directory({
|
|
101
|
-
aliases: ['outputdir', 'output-directory'],
|
|
102
|
-
deprecateAliases: true,
|
|
103
|
-
char: 'd',
|
|
104
|
-
summary: messages.getMessage('flags.output-dir.summary'),
|
|
105
|
-
}),
|
|
106
|
-
'test-level': sf_plugins_core_1.Flags.string({
|
|
107
|
-
deprecateAliases: true,
|
|
108
|
-
aliases: ['testlevel'],
|
|
109
|
-
char: 'l',
|
|
110
|
-
summary: messages.getMessage('flags.test-level.summary'),
|
|
111
|
-
description: messages.getMessage('flags.test-level.description'),
|
|
112
|
-
options: exports.TestLevelValues,
|
|
113
|
-
}),
|
|
114
|
-
'class-names': (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
115
|
-
deprecateAliases: true,
|
|
116
|
-
aliases: ['classnames'],
|
|
117
|
-
char: 'n',
|
|
118
|
-
summary: messages.getMessage('flags.class-names.summary'),
|
|
119
|
-
description: messages.getMessage('flags.class-names.description'),
|
|
120
|
-
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'class-names'),
|
|
121
|
-
}),
|
|
122
|
-
'result-format': sf_plugins_core_1.Flags.string({
|
|
123
|
-
deprecateAliases: true,
|
|
124
|
-
aliases: ['resultformat'],
|
|
125
|
-
char: 'r',
|
|
126
|
-
summary: messages.getMessage('flags.result-format.summary'),
|
|
127
|
-
options: utils_1.resultFormat,
|
|
128
|
-
default: 'human',
|
|
129
|
-
}),
|
|
130
|
-
'suite-names': (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
131
|
-
deprecateAliases: true,
|
|
132
|
-
aliases: ['suitenames'],
|
|
133
|
-
char: 's',
|
|
134
|
-
summary: messages.getMessage('flags.suite-names.summary'),
|
|
135
|
-
description: messages.getMessage('flags.suite-names.description'),
|
|
136
|
-
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'suite-names'),
|
|
137
|
-
}),
|
|
138
|
-
tests: (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
139
|
-
char: 't',
|
|
140
|
-
summary: messages.getMessage('flags.tests.summary'),
|
|
141
|
-
description: messages.getMessage('flags.tests.description'),
|
|
142
|
-
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'tests'),
|
|
143
|
-
}),
|
|
144
|
-
// we want to pass `undefined` to the API
|
|
145
|
-
// eslint-disable-next-line sf-plugin/flag-min-max-default
|
|
146
|
-
wait: sf_plugins_core_1.Flags.duration({
|
|
147
|
-
unit: 'minutes',
|
|
148
|
-
char: 'w',
|
|
149
|
-
summary: messages.getMessage('flags.wait.summary'),
|
|
150
|
-
min: 0,
|
|
151
|
-
}),
|
|
152
|
-
synchronous: sf_plugins_core_1.Flags.boolean({
|
|
153
|
-
char: 'y',
|
|
154
|
-
summary: messages.getMessage('flags.synchronous.summary'),
|
|
155
|
-
}),
|
|
156
|
-
'detailed-coverage': sf_plugins_core_1.Flags.boolean({
|
|
157
|
-
deprecateAliases: true,
|
|
158
|
-
aliases: ['detailedcoverage'],
|
|
159
|
-
char: 'v',
|
|
160
|
-
summary: messages.getMessage('flags.detailed-coverage.summary'),
|
|
161
|
-
dependsOn: ['code-coverage'],
|
|
162
|
-
}),
|
|
163
|
-
};
|
|
164
159
|
// eslint-disable-next-line class-methods-use-this
|
|
165
160
|
const validateFlags = async (classNames, suiteNames, tests, synchronous, testLevel) => {
|
|
166
|
-
if (synchronous && (suiteNames || (classNames?.length && classNames.length > 1))) {
|
|
161
|
+
if (synchronous && (Boolean(suiteNames) || (classNames?.length && classNames.length > 1))) {
|
|
167
162
|
return Promise.reject(new Error(messages.getMessage('syncClassErr')));
|
|
168
163
|
}
|
|
169
|
-
if ((tests || classNames || suiteNames) &&
|
|
164
|
+
if ((Boolean(tests) || Boolean(classNames) || suiteNames) &&
|
|
165
|
+
testLevel &&
|
|
166
|
+
testLevel.toString() !== 'RunSpecifiedTests') {
|
|
170
167
|
return Promise.reject(new Error(messages.getMessage('testLevelErr')));
|
|
171
168
|
}
|
|
172
169
|
if (testLevel) {
|
|
173
170
|
return testLevel;
|
|
174
171
|
}
|
|
175
|
-
if (classNames || suiteNames || tests) {
|
|
172
|
+
if (Boolean(classNames) || Boolean(suiteNames) || tests) {
|
|
176
173
|
return "RunSpecifiedTests" /* TestLevel.RunSpecifiedTests */;
|
|
177
174
|
}
|
|
178
175
|
return "RunLocalTests" /* TestLevel.RunLocalTests */;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/run/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/commands/apex/run/test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,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;AAGrD,OAAO,EAAa,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,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,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,CAAC,OAAO,OAAO,IAAK,SAAQ,SAA2B;IACpD,MAAM,CAAU,OAAO,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AI,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAC1F,SAAS,EACT,IAAI,CAAC,uBAAuB,CAAC,KAAK,CACP,CAAC;IAChC,CAAC;;AAGH,kDAAkD;AAClD,MAAM,aAAa,GAAG,KAAK,EACzB,UAAqB,EACrB,UAAqB,EACrB,KAAgB,EAChB,WAAqB,EACrB,SAAqB,EACD,EAAE;IACtB,IAAI,WAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE;QACzF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;KACvE;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;QACA,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;KACvE;IAED,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,EAAE;QACvD,6DAAmC;KACpC;IACD,qDAA+B;AACjC,CAAC,CAAC"}
|
|
@@ -16,10 +16,10 @@ export default class Run extends SfCommand<ExecuteResult> {
|
|
|
16
16
|
static readonly aliases: string[];
|
|
17
17
|
static deprecateAliases: boolean;
|
|
18
18
|
static readonly flags: {
|
|
19
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
|
-
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
20
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
22
|
+
file: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
23
23
|
};
|
|
24
24
|
run(): Promise<ExecuteResult>;
|
|
25
25
|
}
|
package/lib/commands/apex/run.js
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { ExecuteService } from '@salesforce/apex-node';
|
|
10
|
+
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, SfCommand, } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
12
|
+
import RunReporter from '../../reporters/runReporter.js';
|
|
13
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'run');
|
|
15
|
+
export default class Run extends SfCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
19
|
+
static aliases = ['force:apex:execute'];
|
|
20
|
+
static deprecateAliases = true;
|
|
21
|
+
static flags = {
|
|
22
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
23
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
24
|
+
loglevel,
|
|
25
|
+
file: Flags.file({
|
|
26
|
+
deprecateAliases: true,
|
|
27
|
+
aliases: ['apexcodefile'],
|
|
28
|
+
char: 'f',
|
|
29
|
+
summary: messages.getMessage('flags.file.summary'),
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
16
32
|
async run() {
|
|
17
33
|
const { flags } = await this.parse(Run);
|
|
18
34
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
19
|
-
const exec = new
|
|
35
|
+
const exec = new ExecuteService(conn);
|
|
20
36
|
const execAnonOptions = {
|
|
21
37
|
...(flags.file ? { apexFilePath: flags.file } : { userInput: true }),
|
|
22
38
|
};
|
|
23
39
|
const result = await exec.executeAnonymous(execAnonOptions);
|
|
24
|
-
const formattedResult =
|
|
40
|
+
const formattedResult = RunReporter.formatJson(result);
|
|
25
41
|
if (!result.compiled || !result.success) {
|
|
26
42
|
const err = !result.compiled
|
|
27
|
-
? new
|
|
43
|
+
? new SfError(messages.getMessage('executeCompileFailure', [
|
|
28
44
|
formattedResult.line,
|
|
29
45
|
formattedResult.column,
|
|
30
46
|
formattedResult.compileProblem,
|
|
31
47
|
]), 'executeCompileFailure')
|
|
32
|
-
: new
|
|
48
|
+
: new SfError(messages.getMessage('executeRuntimeFailure', [formattedResult.exceptionMessage]), 'executeRuntimeFailure', []);
|
|
33
49
|
err.setData(formattedResult);
|
|
34
50
|
throw err;
|
|
35
51
|
}
|
|
36
|
-
this.log(
|
|
52
|
+
this.log(RunReporter.formatDefault(result));
|
|
37
53
|
return formattedResult;
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
|
-
exports.default = Run;
|
|
41
|
-
Run.summary = messages.getMessage('summary');
|
|
42
|
-
Run.description = messages.getMessage('description');
|
|
43
|
-
Run.examples = messages.getMessages('examples');
|
|
44
|
-
Run.aliases = ['force:apex:execute'];
|
|
45
|
-
Run.deprecateAliases = true;
|
|
46
|
-
Run.flags = {
|
|
47
|
-
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
48
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
49
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
50
|
-
file: sf_plugins_core_1.Flags.file({
|
|
51
|
-
deprecateAliases: true,
|
|
52
|
-
aliases: ['apexcodefile'],
|
|
53
|
-
char: 'f',
|
|
54
|
-
summary: messages.getMessage('flags.file.summary'),
|
|
55
|
-
}),
|
|
56
|
-
};
|
|
57
56
|
//# sourceMappingURL=run.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/apex/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/apex/run.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAsB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only aliases: string[];
|
|
8
8
|
static readonly flags: {
|
|
9
|
-
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
-
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
-
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
-
color: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
'debug-level': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
-
'skip-trace-flag': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
loglevel: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
color: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
'debug-level': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
'skip-trace-flag': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
15
|
};
|
|
16
16
|
private color;
|
|
17
17
|
run(): Promise<void>;
|