Skip to content

Commit ff654b2

Browse files
authored
fix: add test successes to verbose CI output - W-18531727 (#1358)
* chore: remove catch * fix: add test successes to verbose output in CI
1 parent 33f5c31 commit ff654b2

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

src/formatters/testResultsFormatter.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,15 @@ export class TestResultsFormatter {
5252
// some commands like `project deploy start` will report these failures as they happen via MSO:
5353
// https://github.com/salesforcecli/plugin-deploy-retrieve/pull/1215
5454
//
55-
// commands can set `skipVerboseTestReportOnCI` if so when instantiating the formatter to skip these (false by default).
55+
// commands can enable/disable `skipVerboseTestReportOnCI` when instantiating the formatter to skip these
5656
const skipVerboseTestReport = isCI() && this.skipVerboseTestReportOnCI;
5757

5858
if (!skipVerboseTestReport) {
5959
displayVerboseTestFailures(this.result.response);
6060
}
6161

6262
if (this.verbosity === 'verbose') {
63-
if (!skipVerboseTestReport) {
64-
displayVerboseTestSuccesses(this.result.response.details.runTestResult?.successes);
65-
}
63+
displayVerboseTestSuccesses(this.result.response.details.runTestResult?.successes);
6664
displayVerboseTestCoverage(this.result.response.details.runTestResult?.codeCoverage);
6765
}
6866

test/nuts/deploy/verbose.nut.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,36 @@ describe('Deploy --verbose', () => {
7272
expect(shellOutput.stdout).to.contain('Size: ').and.contain('KB of ~39 MB limit');
7373
expect(shellOutput.stdout).to.contain('Files: 5 of 10,000 limit');
7474
});
75+
76+
it('should have test successes in the output', () => {
77+
const shellOutput = execCmd<DeployResultJson>(
78+
'project deploy start --source-dir force-app --verbose --test-level RunLocalTests --dry-run',
79+
{
80+
ensureExitCode: 0,
81+
}
82+
).shellOutput;
83+
84+
expect(shellOutput.stdout).to.contain('Test Success [1]');
85+
});
86+
87+
it('should have test successes in the output when CI=true', () => {
88+
const ciEnvVar = process.env.CI;
89+
try {
90+
process.env.CI = 'true';
91+
const shellOutput = execCmd<DeployResultJson>(
92+
'project deploy start --source-dir force-app --verbose --test-level RunLocalTests --dry-run',
93+
{
94+
ensureExitCode: 0,
95+
}
96+
).shellOutput;
97+
98+
expect(shellOutput.stdout).to.contain('Test Success [1]');
99+
} finally {
100+
if (ciEnvVar === undefined) {
101+
delete process.env.CI;
102+
} else {
103+
process.env.CI = ciEnvVar;
104+
}
105+
}
106+
});
75107
});

0 commit comments

Comments
 (0)