@@ -8,7 +8,13 @@ import * as path from 'node:path';
8
8
import { EOL } from 'node:os' ;
9
9
import * as fs from 'node:fs' ;
10
10
import { ux } from '@oclif/core' ;
11
- import { ComponentStatus , DeployResult , FileResponse , RequestStatus } from '@salesforce/source-deploy-retrieve' ;
11
+ import {
12
+ ComponentStatus ,
13
+ DeployResult ,
14
+ FileResponse ,
15
+ FileResponseFailure ,
16
+ RequestStatus ,
17
+ } from '@salesforce/source-deploy-retrieve' ;
12
18
import { Org , SfError , Lifecycle } from '@salesforce/core' ;
13
19
import { Duration , ensureArray , sortBy } from '@salesforce/kit' ;
14
20
import {
@@ -131,6 +137,27 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
131
137
return 'normal' ;
132
138
}
133
139
140
+ public getFileResponseFailures ( ) : FileResponseFailure [ ] | undefined {
141
+ const failures = this . relativeFiles . filter ( isSdrFailure ) ;
142
+ const deployMessages = ensureArray ( this . result . response . details ?. componentFailures ) ;
143
+ if ( deployMessages . length > failures . length ) {
144
+ const failureKeySet = new Set ( failures . map ( ( f ) => makeKey ( f . type , f . fullName ) ) ) ;
145
+ // if there's additional failures in the API response, find the failure and add it to the output
146
+ deployMessages
147
+ . filter ( ( m ) => ! m . componentType || ! failureKeySet . has ( makeKey ( m . componentType , m . fullName ) ) )
148
+ . map ( ( deployMessage ) => {
149
+ failures . push ( {
150
+ fullName : deployMessage . fullName ,
151
+ type : deployMessage . componentType ?? 'UNKNOWN' ,
152
+ state : ComponentStatus . Failed ,
153
+ error : deployMessage . problem ?? 'UNKNOWN' ,
154
+ problemType : deployMessage . problemType ?? 'Error' ,
155
+ } ) ;
156
+ } ) ;
157
+ }
158
+ return failures ;
159
+ }
160
+
134
161
private maybeCreateRequestedReports ( ) : void {
135
162
// only generate reports if test results are presented
136
163
if ( this . coverageOptions . reportFormats ?. length ) {
@@ -269,24 +296,8 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
269
296
private displayFailures ( ) : void {
270
297
if ( this . result . response . status === RequestStatus . Succeeded ) return ;
271
298
272
- const failures = this . relativeFiles . filter ( isSdrFailure ) ;
273
- const deployMessages = ensureArray ( this . result . response . details ?. componentFailures ) ;
274
- if ( deployMessages . length > failures . length ) {
275
- const failureKeySet = new Set ( failures . map ( ( f ) => makeKey ( f . type , f . fullName ) ) ) ;
276
- // if there's additional failures in the API response, find the failure and add it to the output
277
- deployMessages
278
- . filter ( ( m ) => ! m . componentType || ! failureKeySet . has ( makeKey ( m . componentType , m . fullName ) ) )
279
- . map ( ( deployMessage ) => {
280
- failures . push ( {
281
- fullName : deployMessage . fullName ,
282
- type : deployMessage . componentType ?? 'UNKNOWN' ,
283
- state : ComponentStatus . Failed ,
284
- error : deployMessage . problem ?? 'UNKNOWN' ,
285
- problemType : deployMessage . problemType ?? 'Error' ,
286
- } ) ;
287
- } ) ;
288
- }
289
- if ( ! failures . length ) return ;
299
+ const failures = this . getFileResponseFailures ( ) ;
300
+ if ( ! failures ?. length ) return ;
290
301
291
302
const columns = {
292
303
problemType : { header : 'Type' } ,
0 commit comments