Skip to content

Commit b9f8567

Browse files
committed
fix: default result format human + coverage depends on result format
@W-12679981@
1 parent bfb739f commit b9f8567

File tree

5 files changed

+11
-51
lines changed

5 files changed

+11
-51
lines changed

messages/runtest.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ Runs test methods from a single Apex class synchronously; if not specified, test
9191

9292
Display detailed code coverage per test.
9393

94-
# missingReporterErr
95-
96-
Select a result format when specifying code coverage
97-
9894
# runTestReportCommand
9995

10096
Run "%s apex get test -i %s -o %s" to retrieve test results

src/commands/apex/get/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default class Test extends SfCommand<RunResult> {
5757
char: 'r',
5858
summary: messages.getMessage('flags.result-format.summary'),
5959
options: resultFormat,
60+
default: 'human',
6061
}),
6162
};
6263

src/commands/apex/run/test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default class Test extends SfCommand<RunCommandResult> {
4040
deprecateAliases: true,
4141
char: 'c',
4242
summary: messages.getMessage('flags.code-coverage.summary'),
43+
dependsOn: ['result-format'],
4344
}),
4445
'output-dir': Flags.directory({
4546
aliases: ['outputdir', 'output-directory'],
@@ -68,6 +69,7 @@ export default class Test extends SfCommand<RunCommandResult> {
6869
char: 'r',
6970
summary: messages.getMessage('flags.result-format.summary'),
7071
options: resultFormat,
72+
default: 'human',
7173
}),
7274
'suite-names': Flags.string({
7375
deprecateAliases: true,
@@ -174,10 +176,6 @@ export default class Test extends SfCommand<RunCommandResult> {
174176
synchronous?: boolean,
175177
testLevel?: TestLevel
176178
): Promise<TestLevel> {
177-
if (codeCoverage && !resultFormatFlag) {
178-
return Promise.reject(new Error(messages.getMessage('missingReporterErr')));
179-
}
180-
181179
if ((classNames && (suiteNames || tests)) || (suiteNames && tests)) {
182180
return Promise.reject(new Error(messages.getMessage('classSuiteTestErr')));
183181
}

test/commands/apex/run/test.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,14 @@ describe('apex:test:run', () => {
368368
});
369369

370370
describe('validateFlags', () => {
371-
// TODO: move this method to oclif flag validation
372-
it('rejects codecoverage without resultformat', async () => {
373-
try {
374-
await new Test(['--code-coverage'], config).run();
375-
} catch (e) {
376-
expect((e as Error).message).to.equal(messages.getMessage('missingReporterErr'));
377-
}
378-
});
379-
371+
// it('rejects codecoverage without resultformat', async () => {
372+
// try {
373+
// await new Test(['--code-coverage'], config).run();
374+
// } catch (e) {
375+
// expect((e as Error).message).to.include('following must be provided when using --code-coverage: --result-format');
376+
// }
377+
// });
378+
//
380379
it('rejects tests/classnames/suitenames and testlevels', async () => {
381380
try {
382381
await new Test(['--tests', 'mytest', '--test-level', 'RunAllTestsInOrg'], config).run();

yarn.lock

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,14 +1369,6 @@
13691369
"@typescript-eslint/types" "5.54.1"
13701370
"@typescript-eslint/visitor-keys" "5.54.1"
13711371

1372-
"@typescript-eslint/[email protected]":
1373-
version "5.54.1"
1374-
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz#6d864b4915741c608a58ce9912edf5a02bb58735"
1375-
integrity sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==
1376-
dependencies:
1377-
"@typescript-eslint/types" "5.54.1"
1378-
"@typescript-eslint/visitor-keys" "5.54.1"
1379-
13801372
"@typescript-eslint/[email protected]":
13811373
version "5.53.0"
13821374
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz#41665449935ba9b4e6a1ba6e2a3f4b2c31d6cf97"
@@ -1397,11 +1389,6 @@
13971389
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c"
13981390
integrity sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==
13991391

1400-
"@typescript-eslint/[email protected]":
1401-
version "5.54.1"
1402-
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c"
1403-
integrity sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==
1404-
14051392
"@typescript-eslint/[email protected]":
14061393
version "5.53.0"
14071394
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz#bc651dc28cf18ab248ecd18a4c886c744aebd690"
@@ -1428,19 +1415,6 @@
14281415
semver "^7.3.7"
14291416
tsutils "^3.21.0"
14301417

1431-
"@typescript-eslint/[email protected]":
1432-
version "5.54.1"
1433-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz#df7b6ae05fd8fef724a87afa7e2f57fa4a599be1"
1434-
integrity sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==
1435-
dependencies:
1436-
"@typescript-eslint/types" "5.54.1"
1437-
"@typescript-eslint/visitor-keys" "5.54.1"
1438-
debug "^4.3.4"
1439-
globby "^11.1.0"
1440-
is-glob "^4.0.3"
1441-
semver "^7.3.7"
1442-
tsutils "^3.21.0"
1443-
14441418
"@typescript-eslint/[email protected]":
14451419
version "5.53.0"
14461420
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.53.0.tgz#e55eaad9d6fffa120575ffaa530c7e802f13bce8"
@@ -1485,14 +1459,6 @@
14851459
"@typescript-eslint/types" "5.54.1"
14861460
eslint-visitor-keys "^3.3.0"
14871461

1488-
"@typescript-eslint/[email protected]":
1489-
version "5.54.1"
1490-
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz#d7a8a0f7181d6ac748f4d47b2306e0513b98bf8b"
1491-
integrity sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==
1492-
dependencies:
1493-
"@typescript-eslint/types" "5.54.1"
1494-
eslint-visitor-keys "^3.3.0"
1495-
14961462
14971463
version "1.1.2"
14981464
resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"

0 commit comments

Comments
 (0)