@salesforce/plugin-apex 3.7.0 → 3.8.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/LICENSE.txt +200 -6
- package/README.md +128 -8
- package/lib/commands/apex/get/log.js +13 -4
- package/lib/commands/apex/get/log.js.map +1 -1
- package/lib/commands/apex/get/test.js +13 -4
- package/lib/commands/apex/get/test.js.map +1 -1
- package/lib/commands/apex/list/log.js +13 -4
- package/lib/commands/apex/list/log.js.map +1 -1
- package/lib/commands/apex/run/test.d.ts +3 -8
- package/lib/commands/apex/run/test.js +33 -96
- package/lib/commands/apex/run/test.js.map +1 -1
- package/lib/commands/apex/run.js +13 -4
- package/lib/commands/apex/run.js.map +1 -1
- package/lib/commands/apex/tail/log.js +13 -4
- package/lib/commands/apex/tail/log.js.map +1 -1
- package/lib/commands/logic/get/test.d.ts +1 -0
- package/lib/commands/logic/get/test.js +14 -4
- package/lib/commands/logic/get/test.js.map +1 -1
- package/lib/commands/logic/run/test.d.ts +28 -0
- package/lib/commands/logic/run/test.js +130 -0
- package/lib/commands/logic/run/test.js.map +1 -0
- package/lib/flags.js +13 -4
- package/lib/flags.js.map +1 -1
- package/lib/index.js +13 -4
- package/lib/index.js.map +1 -1
- package/lib/logColorize.js +13 -4
- package/lib/logColorize.js.map +1 -1
- package/lib/reporters/index.js +13 -4
- package/lib/reporters/index.js.map +1 -1
- package/lib/reporters/jsonReporter.js.map +1 -1
- package/lib/reporters/runReporter.js +13 -4
- package/lib/reporters/runReporter.js.map +1 -1
- package/lib/reporters/testReporter.js +14 -5
- package/lib/reporters/testReporter.js.map +1 -1
- package/lib/shared/TestGetBase.js +13 -4
- package/lib/shared/TestGetBase.js.map +1 -1
- package/lib/shared/TestRunService.d.ts +61 -0
- package/lib/shared/TestRunService.js +161 -0
- package/lib/shared/TestRunService.js.map +1 -0
- package/messages/runlogictest.md +41 -0
- package/messages/runtest.md +2 -33
- package/messages/runtestcommon.md +40 -0
- package/oclif.manifest.json +255 -2
- package/package.json +11 -7
|
@@ -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":"AA+FA,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,MAAkB,EAAE,kBAA2B,KAAK;QAChE,MAAM,YAAY,GAAc;YAC9B,OAAO,EAAE;gBACP,oIAAoI;gBACpI,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;gBAC/B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAkC;gBAC1D,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;gBAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;gBAC/B,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS;gBACnC,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa;gBAC3C,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM;gBAC7B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,WAAW,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,KAAK;gBACnD,iBAAiB,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,KAAK;gBAC/D,aAAa,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,KAAK;aACxD;YACD,KAAK,EAA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,WAAW,EAAE,EAAE;wBAC5C,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;4BACxB,aAAa,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;4BACzD,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC,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;yBACjD,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the
|
|
5
|
-
*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
6
15
|
*/
|
|
7
16
|
import os from 'node:os';
|
|
8
17
|
import { Messages } from '@salesforce/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runReporter.js","sourceRoot":"","sources":["../../src/reporters/runReporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;AAEzE,MAAM,CAAC,OAAO,OAAO,WAAW;IACvB,MAAM,CAAC,aAAa,CAAC,QAAkC;QAC5D,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,UAAU,CAAC,IAAI,CACb,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC,EACpE,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC,EACpE,EAAE,EACF,QAAQ,CAAC,IAAI,IAAI,EAAE,CACpB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACzB,MAAM,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC3D,CAAC;YACD,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACvB,UAAU,CAAC,IAAI,CACb,cAAc,CAAC,K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,CAAC;CACF"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the
|
|
5
|
-
*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
6
15
|
*/
|
|
7
16
|
import { HumanReporter, JUnitReporter, ResultFormat, TapReporter, TestService, } from '@salesforce/apex-node';
|
|
8
17
|
import { Messages } from '@salesforce/core';
|
|
9
18
|
import { JsonReporter } from './jsonReporter.js';
|
|
10
19
|
const FAILURE_EXIT_CODE = 100;
|
|
11
20
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
|
-
const messages = Messages.loadMessages('@salesforce/plugin-apex', '
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtestcommon');
|
|
13
22
|
export class TestReporter {
|
|
14
23
|
ux;
|
|
15
24
|
connection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"testReporter.js","sourceRoot":"","sources":["../../src/reporters/testReporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EAEb,YAAY,EACZ,WAAW,EAGX,WAA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1C,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACvF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAEO,MAAM,CAAC,MAAkB;QAC/B,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,QAAQ,CAAC,MAAkB;QACjC,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,CAAC;IAEO,gBAAgB,CAAC,MAAkB;QACzC,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC;QAChD,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,IAAI,OAAO,QAAQ,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,QAAQ,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the
|
|
5
|
-
*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
6
15
|
*/
|
|
7
16
|
import { TestService } from '@salesforce/apex-node';
|
|
8
17
|
import { Ux } from '@salesforce/sf-plugins-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestGetBase.js","sourceRoot":"","sources":["../../src/shared/TestGetBase.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TestGetBase.js","sourceRoot":"","sources":["../../src/shared/TestGetBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAa,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAiBhE;;GAEG;AACH,MAAM,OAAO,WAAW;IACf,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAA2B;QACrD,MAAM,EACJ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,cAAc,EACf,GAAG,OAAO,CAAC;QAEZ,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAE7E,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QAE3E,MAAM,aAAa,GAAG;YACpB,YAAY,EAAE,SAAS;YACvB,eAAe,EAAE,YAAY;YAC7B,IAAI;YACJ,eAAe,EAAE,YAAY;YAC7B,mBAAmB,EAAE,gBAAgB;YACrC,OAAO,EAAE,OAAO,IAAI,KAAK;YACzB,cAAc;SACf,CAAC;QAEF,OAAO,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CancellationTokenSource, TestRunIdResult } from '@salesforce/apex-node';
|
|
2
|
+
import { Connection } from '@salesforce/core';
|
|
3
|
+
import { Duration } from '@salesforce/kit';
|
|
4
|
+
import { RunResult } from '../reporters/index.js';
|
|
5
|
+
export declare const TestLevelValues: string[];
|
|
6
|
+
export type RunCommandResult = RunResult | TestRunIdResult;
|
|
7
|
+
export type TestRunFlags = {
|
|
8
|
+
'code-coverage'?: boolean;
|
|
9
|
+
'output-dir'?: string;
|
|
10
|
+
'test-level'?: string;
|
|
11
|
+
'class-names'?: string[];
|
|
12
|
+
'suite-names'?: string[];
|
|
13
|
+
tests?: string[];
|
|
14
|
+
wait?: Duration;
|
|
15
|
+
synchronous?: boolean;
|
|
16
|
+
'detailed-coverage'?: boolean;
|
|
17
|
+
concise?: boolean;
|
|
18
|
+
'result-format'?: string;
|
|
19
|
+
json?: boolean;
|
|
20
|
+
'test-category'?: string[];
|
|
21
|
+
};
|
|
22
|
+
export type TestRunConfig = {
|
|
23
|
+
commandType: 'apex' | 'logic';
|
|
24
|
+
exclusiveTestSpecifiers: string[];
|
|
25
|
+
binName: string;
|
|
26
|
+
};
|
|
27
|
+
export type TestRunContext = {
|
|
28
|
+
flags: TestRunFlags;
|
|
29
|
+
config: TestRunConfig;
|
|
30
|
+
connection: Connection;
|
|
31
|
+
jsonEnabled: boolean;
|
|
32
|
+
cancellationToken: CancellationTokenSource;
|
|
33
|
+
log: (message: string) => void;
|
|
34
|
+
info: (message: string) => void;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Shared service for running tests with command-specific behavior
|
|
38
|
+
*/
|
|
39
|
+
export declare class TestRunService {
|
|
40
|
+
static runTestCommand(context: TestRunContext): Promise<RunCommandResult>;
|
|
41
|
+
private static runTest;
|
|
42
|
+
private static runTestAsynchronous;
|
|
43
|
+
/**
|
|
44
|
+
* Get test category based on command type and flags
|
|
45
|
+
* - apex command: always returns 'Apex'
|
|
46
|
+
* - logic command: returns test-category flag value or defaults to all categories
|
|
47
|
+
*/
|
|
48
|
+
private static getTestCategory;
|
|
49
|
+
/**
|
|
50
|
+
* Log appropriate async test instructions based on command type
|
|
51
|
+
*/
|
|
52
|
+
private static logAsyncTestInstructions;
|
|
53
|
+
/**
|
|
54
|
+
* Handle testing server errors with command-specific messaging
|
|
55
|
+
*/
|
|
56
|
+
private static handleTestingServerError;
|
|
57
|
+
/**
|
|
58
|
+
* Validate flags with command-specific logic
|
|
59
|
+
*/
|
|
60
|
+
private static validateFlags;
|
|
61
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { TestService } from '@salesforce/apex-node';
|
|
17
|
+
import { Ux } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
19
|
+
import { TestReporter } from '../reporters/index.js';
|
|
20
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-apex', 'runtestcommon');
|
|
22
|
+
export const TestLevelValues = ['RunLocalTests', 'RunAllTestsInOrg', 'RunSpecifiedTests'];
|
|
23
|
+
/**
|
|
24
|
+
* Shared service for running tests with command-specific behavior
|
|
25
|
+
*/
|
|
26
|
+
export class TestRunService {
|
|
27
|
+
static async runTestCommand(context) {
|
|
28
|
+
const { flags, config, connection, cancellationToken } = context;
|
|
29
|
+
const testLevel = await TestRunService.validateFlags(flags['class-names'], flags['suite-names'], flags.tests, flags.synchronous, flags['test-level'], flags['test-category'], config);
|
|
30
|
+
const testService = new TestService(connection);
|
|
31
|
+
// NOTE: This is a *bug*. Synchronous test runs should throw an error when multiple test classes are specified
|
|
32
|
+
// This was re-introduced due to https://github.com/forcedotcom/salesforcedx-vscode/issues/3154
|
|
33
|
+
// Address with W-9163533
|
|
34
|
+
const result = flags.synchronous && testLevel === "RunSpecifiedTests" /* TestLevel.RunSpecifiedTests */
|
|
35
|
+
? await TestRunService.runTest(testService, flags, testLevel, config, cancellationToken)
|
|
36
|
+
: await TestRunService.runTestAsynchronous(testService, flags, testLevel, config, cancellationToken);
|
|
37
|
+
if (cancellationToken.token.isCancellationRequested) {
|
|
38
|
+
throw new SfError('Cancelled');
|
|
39
|
+
}
|
|
40
|
+
if ('summary' in result) {
|
|
41
|
+
const testReporter = new TestReporter(new Ux({ jsonEnabled: context.jsonEnabled }), connection);
|
|
42
|
+
const reportFlags = {
|
|
43
|
+
...flags,
|
|
44
|
+
concise: flags.concise ?? false,
|
|
45
|
+
...(config.commandType === 'logic' ? { isUnifiedLogic: true } : {}),
|
|
46
|
+
};
|
|
47
|
+
return testReporter.report(result, reportFlags);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Tests were ran asynchronously or the --wait timed out.
|
|
51
|
+
// Log the proper 'get test' command for the user to run later
|
|
52
|
+
TestRunService.logAsyncTestInstructions(result, connection.getUsername?.() ?? 'unknown', config, context.log);
|
|
53
|
+
context.info(messages.getMessage('runTestSyncInstructions'));
|
|
54
|
+
if (flags['output-dir']) {
|
|
55
|
+
// testService writes a file with just the test run id in it to test-run-id.txt
|
|
56
|
+
// github.com/forcedotcom/salesforcedx-apex/blob/c986abfabee3edf12f396f1d2e43720988fa3911/src/tests/testService.ts#L245-L246
|
|
57
|
+
await testService.writeResultFiles(result, { dirPath: flags['output-dir'] }, flags['code-coverage']);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
static async runTest(testService, flags, testLevel, config, cancellationToken) {
|
|
63
|
+
const testCategory = TestRunService.getTestCategory(flags, config);
|
|
64
|
+
const payload = {
|
|
65
|
+
...(await testService.buildSyncPayload(testLevel, flags.tests?.join(','), flags['class-names']?.join(','), testCategory)),
|
|
66
|
+
skipCodeCoverage: !flags['code-coverage'],
|
|
67
|
+
};
|
|
68
|
+
try {
|
|
69
|
+
return (await testService.runTestSynchronous(payload, flags['code-coverage'], cancellationToken.token));
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw TestRunService.handleTestingServerError(SfError.wrap(e), flags, testLevel, config);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
static async runTestAsynchronous(testService, flags, testLevel, config, cancellationToken) {
|
|
76
|
+
const testCategory = TestRunService.getTestCategory(flags, config);
|
|
77
|
+
const payload = {
|
|
78
|
+
...(await testService.buildAsyncPayload(testLevel, flags.tests?.join(','), flags['class-names']?.join(','), flags['suite-names']?.join(','), testCategory)),
|
|
79
|
+
skipCodeCoverage: !flags['code-coverage'],
|
|
80
|
+
};
|
|
81
|
+
try {
|
|
82
|
+
// cast as TestRunIdResult because we're building an async payload which will return an async result
|
|
83
|
+
return (await testService.runTestAsynchronous(payload, flags['code-coverage'], flags.wait && flags.wait.minutes > 0 ? false : !(flags.synchronous && !flags.json), undefined, cancellationToken.token, flags.wait));
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
throw TestRunService.handleTestingServerError(SfError.wrap(e), flags, testLevel, config);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get test category based on command type and flags
|
|
91
|
+
* - apex command: always returns 'Apex'
|
|
92
|
+
* - logic command: returns test-category flag value or defaults to all categories
|
|
93
|
+
*/
|
|
94
|
+
static getTestCategory(flags, config) {
|
|
95
|
+
if (config.commandType === 'apex') {
|
|
96
|
+
return 'Apex';
|
|
97
|
+
}
|
|
98
|
+
// logic command
|
|
99
|
+
return flags['test-category']?.join(',') ?? '';
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Log appropriate async test instructions based on command type
|
|
103
|
+
*/
|
|
104
|
+
static logAsyncTestInstructions(result, username, config, log) {
|
|
105
|
+
if (config.commandType === 'logic') {
|
|
106
|
+
log(messages.getMessage('runLogicTestReportCommand', [config.binName, result.testRunId, username]));
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
log(messages.getMessage('runTestReportCommand', [config.binName, result.testRunId, username]));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Handle testing server errors with command-specific messaging
|
|
114
|
+
*/
|
|
115
|
+
static handleTestingServerError(error, flags, testLevel, config) {
|
|
116
|
+
if (!error.message.includes('Always provide a classes, suites, tests, or testLevel property')) {
|
|
117
|
+
return error;
|
|
118
|
+
}
|
|
119
|
+
// If error message condition is valid, return the original error.
|
|
120
|
+
const hasSpecifiedTestLevel = testLevel === "RunSpecifiedTests" /* TestLevel.RunSpecifiedTests */;
|
|
121
|
+
const hasNoTestNames = !flags.tests?.length;
|
|
122
|
+
const hasNoClassNames = !flags['class-names']?.length;
|
|
123
|
+
const hasNoSuiteNames = !flags['suite-names']?.length;
|
|
124
|
+
if (hasSpecifiedTestLevel && hasNoTestNames && hasNoClassNames && hasNoSuiteNames) {
|
|
125
|
+
return error;
|
|
126
|
+
}
|
|
127
|
+
// Otherwise, assume there are no tests in the org and return clearer message.
|
|
128
|
+
const testType = config.commandType === 'apex' ? 'Apex' : 'Logic';
|
|
129
|
+
return Object.assign(error, {
|
|
130
|
+
message: `There are no ${testType} tests to run in this org.`,
|
|
131
|
+
actions: [`Ensure ${testType} Tests exist in the org, and try again.`],
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Validate flags with command-specific logic
|
|
136
|
+
*/
|
|
137
|
+
static async validateFlags(classNames, suiteNames, tests, synchronous, testLevel, testCategory, config) {
|
|
138
|
+
if (synchronous && (Boolean(suiteNames) || (classNames && classNames.length > 1))) {
|
|
139
|
+
return config?.commandType === 'apex'
|
|
140
|
+
? Promise.reject(new Error(messages.getMessage('syncClassErr')))
|
|
141
|
+
: Promise.reject(new Error(messages.getMessage('syncClassErrForUnifiedLogic')));
|
|
142
|
+
}
|
|
143
|
+
// Validate that test-level is required when test-category is specified (logic command only)
|
|
144
|
+
if (config?.commandType === 'logic' && testCategory && testCategory.length > 0 && !testLevel) {
|
|
145
|
+
return Promise.reject(new Error('When using --test-category, you must also specify --test-level.'));
|
|
146
|
+
}
|
|
147
|
+
if ((Boolean(tests) || Boolean(classNames) || suiteNames) &&
|
|
148
|
+
testLevel &&
|
|
149
|
+
testLevel.toString() !== 'RunSpecifiedTests') {
|
|
150
|
+
return Promise.reject(new Error(messages.getMessage('testLevelErr')));
|
|
151
|
+
}
|
|
152
|
+
if (testLevel) {
|
|
153
|
+
return testLevel;
|
|
154
|
+
}
|
|
155
|
+
if (Boolean(classNames) || Boolean(suiteNames) || tests) {
|
|
156
|
+
return "RunSpecifiedTests" /* TestLevel.RunSpecifiedTests */;
|
|
157
|
+
}
|
|
158
|
+
return "RunLocalTests" /* TestLevel.RunLocalTests */;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sour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
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Invoke tests for Apex and Flows in an org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
This command provides a single and unified way to run tests for multiple Salesforce features, such as Apex classes and Flows. Running the tests together with a single command ensures seamless interoperability between the features.
|
|
8
|
+
|
|
9
|
+
By default, the command executes asynchronously and returns a test run ID. Then use the "sf logic get test" command to retrieve the results. If you want to wait for the test run to complete and see the results in the command output, use the --synchronous flag.
|
|
10
|
+
|
|
11
|
+
To run specific tests, use the --tests flag, passing it the Apex test class names or the Flow tests in the form Flowtest.<name>. You can also run specific test methods, although if you run the tests synchronously, the methods must belong to a single Apex class or Flow test. To run all tests of a certain category, use --test-level with --test-category. If neither flag is specified, all local tests for all categories are run by default. You can also use the --class-names and --suite-names flags to run Apex test classes or suites.
|
|
12
|
+
|
|
13
|
+
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 the tested classes or flows. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.
|
|
14
|
+
|
|
15
|
+
You must have the "View All Data" org system permission to use this command. The permission is disabled by default and can be enabled only by a system administrator.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- Run a mix of specific Apex and Flow tests asynchronously in your default org:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %> --tests MyApexClassTest,FlowTest.ProcessOrder
|
|
22
|
+
|
|
23
|
+
- Run all local Apex and Flow tests and wait for the results to complete; run the tests in the org with alias "my-scratch":
|
|
24
|
+
|
|
25
|
+
<%= config.bin %> <%= command.id %> --test-level RunLocalTests --test-category Apex --test-category Flow --synchronous --target-org my-scratch
|
|
26
|
+
|
|
27
|
+
- Run two methods in an Apex test class and an Apex test suite:
|
|
28
|
+
|
|
29
|
+
<%= config.bin %> <%= command.id %> --class-names MyApexClassTest.methodA --class-names MyApexClassTest.methodB --suite-names MySuite
|
|
30
|
+
|
|
31
|
+
- Run all local tests for all categories (the default behavior), save the JUnit results to the "test-results" directory, and include code coverage results:
|
|
32
|
+
|
|
33
|
+
<%= config.bin %> <%= command.id %> --result-format junit --output-dir test-results --synchronous --code-coverage
|
|
34
|
+
|
|
35
|
+
# flags.logicTests.summary
|
|
36
|
+
|
|
37
|
+
Comma-separated list of test names to run. Can include Apex test classes and Flow tests.
|
|
38
|
+
|
|
39
|
+
# flags.test-category.summary
|
|
40
|
+
|
|
41
|
+
Category of tests to run, such as Apex or Flow.
|
package/messages/runtest.md
CHANGED
|
@@ -10,6 +10,8 @@ To see code coverage results, use the --code-coverage flag with --result-format.
|
|
|
10
10
|
|
|
11
11
|
By default, Apex tests run asynchronously and immediately return a test run ID. You can use the --wait flag to specify the number of minutes to wait; if the tests finish in that timeframe, the command displays the results. If the tests haven't finished by the end of the wait time, the command displays a test run ID. Use the "<%= config.bin %> apex get test --test-run-id" command to get the results.
|
|
12
12
|
|
|
13
|
+
To run both Apex and Flow tests together, run the "sf logic run test" CLI command, which has similar flags as this command, but expands the --tests flag to also include Flow tests.
|
|
14
|
+
|
|
13
15
|
You must have the "View All Data" system permission to use this command. The permission is disabled by default and can be enabled only by a system administrator.
|
|
14
16
|
|
|
15
17
|
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.
|
|
@@ -125,36 +127,3 @@ Display detailed code coverage per test.
|
|
|
125
127
|
# flags.concise.summary
|
|
126
128
|
|
|
127
129
|
Display only failed test results; works with human-readable output only.
|
|
128
|
-
|
|
129
|
-
# runTestReportCommand
|
|
130
|
-
|
|
131
|
-
Run "%s apex get test -i %s -o %s" to retrieve test results
|
|
132
|
-
|
|
133
|
-
# runTestSyncInstructions
|
|
134
|
-
|
|
135
|
-
Run with --synchronous or increase --wait timeout to wait for results.
|
|
136
|
-
|
|
137
|
-
# syncClassErr
|
|
138
|
-
|
|
139
|
-
Synchronous test runs can include test methods from only one Apex class. Omit the --synchronous flag or include tests from only one class
|
|
140
|
-
|
|
141
|
-
# testLevelErr
|
|
142
|
-
|
|
143
|
-
When specifying classnames, suitenames, or tests, indicate RunSpecifiedTests as the testlevel
|
|
144
|
-
|
|
145
|
-
# testResultProcessErr
|
|
146
|
-
|
|
147
|
-
Encountered an error when processing test results
|
|
148
|
-
%s
|
|
149
|
-
|
|
150
|
-
# apexTestReportFormatHint
|
|
151
|
-
|
|
152
|
-
Run "sf apex get test %s --result-format <format>" to retrieve test results in a different format.
|
|
153
|
-
|
|
154
|
-
# outputDirHint
|
|
155
|
-
|
|
156
|
-
Test result files written to %s
|
|
157
|
-
|
|
158
|
-
# apexLibErr
|
|
159
|
-
|
|
160
|
-
Unknown error in Apex Library: %s
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# runTestReportCommand
|
|
2
|
+
|
|
3
|
+
Run "%s apex get test -i %s -o %s" to retrieve test results
|
|
4
|
+
|
|
5
|
+
# runLogicTestReportCommand
|
|
6
|
+
|
|
7
|
+
Run "%s logic get test -i %s -o %s" to retrieve test results
|
|
8
|
+
|
|
9
|
+
# runTestSyncInstructions
|
|
10
|
+
|
|
11
|
+
Run with --synchronous or increase --wait timeout to wait for results.
|
|
12
|
+
|
|
13
|
+
# syncClassErr
|
|
14
|
+
|
|
15
|
+
Synchronous test runs can include test methods from only one Apex class. Omit the --synchronous flag or include tests from only one class
|
|
16
|
+
|
|
17
|
+
# syncClassErrForUnifiedLogic
|
|
18
|
+
|
|
19
|
+
-- Synchronous test runs can include test methods from only one Apex class or Flow test. Omit the --synchronous flag or include tests from only one class
|
|
20
|
+
|
|
21
|
+
# testLevelErr
|
|
22
|
+
|
|
23
|
+
When specifying classnames, suitenames, or tests, indicate RunSpecifiedTests as the testlevel
|
|
24
|
+
|
|
25
|
+
# testResultProcessErr
|
|
26
|
+
|
|
27
|
+
Encountered an error when processing test results
|
|
28
|
+
%s
|
|
29
|
+
|
|
30
|
+
# apexTestReportFormatHint
|
|
31
|
+
|
|
32
|
+
Run "sf apex get test %s --result-format <format>" to retrieve test results in a different format.
|
|
33
|
+
|
|
34
|
+
# outputDirHint
|
|
35
|
+
|
|
36
|
+
Test result files written to %s
|
|
37
|
+
|
|
38
|
+
# apexLibErr
|
|
39
|
+
|
|
40
|
+
Unknown error in Apex Library: %s
|