Skip to content

Commit e422ca5

Browse files
committed
feat: show passing and failing tests
1 parent b9c530d commit e422ca5

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/testStages.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ import { Lifecycle } from '@salesforce/core';
1212
import { Duration } from '@salesforce/kit';
1313
import { Ux } from '@salesforce/sf-plugins-core';
1414

15-
type Data = { id: string; status: string };
15+
type Data = {
16+
id: string;
17+
status: string;
18+
totalTestCases: number;
19+
passingTestCases: number;
20+
failingTestCases: number;
21+
};
1622

1723
const isTimeoutError = (e: unknown): e is { name: 'PollingClientTimeout' } =>
1824
(e as { name: string })?.name === 'PollingClientTimeout';
@@ -34,6 +40,18 @@ export class TestStages {
3440
label: 'Status',
3541
get: (data): string | undefined => data?.status,
3642
},
43+
{
44+
stage: 'Polling for Test Results',
45+
type: 'dynamic-key-value',
46+
label: 'Passing Tests',
47+
get: (data): string | undefined => data?.passingTestCases?.toString(),
48+
},
49+
{
50+
stage: 'Polling for Test Results',
51+
type: 'dynamic-key-value',
52+
label: 'Failing Tests',
53+
get: (data): string | undefined => data?.failingTestCases?.toString(),
54+
},
3755
],
3856
postStagesBlock: [
3957
{
@@ -52,8 +70,15 @@ export class TestStages {
5270
public async poll(agentTester: AgentTester, id: string, wait: Duration): Promise<boolean> {
5371
this.mso.skipTo('Polling for Test Results');
5472
const lifecycle = Lifecycle.getInstance();
55-
lifecycle.on('AGENT_TEST_POLLING_EVENT', async (event: { status: string }) =>
56-
Promise.resolve(this.update({ status: event?.status }))
73+
lifecycle.on(
74+
'AGENT_TEST_POLLING_EVENT',
75+
async (event: {
76+
status: string;
77+
completedTestCases: number;
78+
totalTestCases: number;
79+
failingTestCases: number;
80+
passingTestCases: number;
81+
}) => Promise.resolve(this.update(event))
5782
);
5883

5984
try {

0 commit comments

Comments
 (0)