@@ -24,7 +24,7 @@ if (!isNaN(terminalWidth)) lineSeparator = "\n" + "-".repeat(terminalWidth);
24
24
25
25
let getOptions = ( auth , build_id ) => {
26
26
return {
27
- url : `${ config . buildUrl } ${ build_id } ` ,
27
+ url : `${ config . buildUrlV2 } ${ build_id } ` ,
28
28
auth : {
29
29
user : auth . username ,
30
30
password : auth . access_key
@@ -144,18 +144,31 @@ let whileProcess = (whilstCallback) => {
144
144
145
145
whileTries = config . retries ; // reset to default after every successful request
146
146
147
+ console . log ( `---> response code: ${ response . statusCode } body is: ${ JSON . stringify ( body ) } ` )
147
148
switch ( response . statusCode ) {
148
149
case 202 : // get data here and print it
149
150
n = 2
150
- showSpecsStatus ( body ) ;
151
+ // try {
152
+ // parsed_body = JSON.parse(JSON.stringify(body));
153
+ // showSpecsStatus(parsed_body['data']);
154
+ // } catch (error) {
155
+ // console.log(`---> Got error: ${JSON.stringify(error)}`)
156
+ // }
157
+ showSpecsStatus ( body , 202 ) ;
151
158
return setTimeout ( whilstCallback , timeout * n , null ) ;
152
159
case 204 : // No data available, wait for some time and ask again
153
160
n = 1
154
161
return setTimeout ( whilstCallback , timeout * n , null ) ;
155
162
case 200 : // Build is completed.
156
163
whileLoop = false ;
157
164
endTime = Date . now ( ) ;
158
- showSpecsStatus ( body ) ;
165
+ // try {
166
+ // parsed_body = JSON.parse(body);
167
+ // showSpecsStatus(JSON.stringify(parsed_body['data']));
168
+ // } catch (error) {
169
+ // console.log(`---> Got error: ${JSON.stringify(error)}`)
170
+ // }
171
+ showSpecsStatus ( body , 200 ) ;
159
172
return specSummary . exitCode == Constants . BUILD_FAILED_EXIT_CODE ?
160
173
whilstCallback ( { status : 204 , message : "No specs ran in the build" } ) : whilstCallback ( null , body ) ;
161
174
default :
@@ -169,9 +182,9 @@ let getStackTraceUrl = () => {
169
182
return specSummary . buildError
170
183
}
171
184
172
- let showSpecsStatus = ( data ) => {
185
+ let showSpecsStatus = ( data , statusCode ) => {
173
186
let specData = JSON . parse ( data ) ;
174
- specData . forEach ( specDetails => {
187
+ specData [ "specDetails" ] . forEach ( specDetails => {
175
188
if ( specDetails . type === Constants . CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY ) {
176
189
addCustomErrorToPrint ( specDetails ) ;
177
190
} else {
@@ -190,6 +203,14 @@ let showSpecsStatus = (data) => {
190
203
}
191
204
}
192
205
} ) ;
206
+ if ( statusCode != 200 ) return ;
207
+ // Below block is for printing build details, return if non 200 status code
208
+ if ( "buildDetails" in specData ) {
209
+ const buildDetails = specData [ "buildDetails" ] ;
210
+ logger . info ( `Done in ${ buildDetails [ "duration" ] } seconds with ${ buildDetails [ "parallels" ] } parallels.\n` ) ;
211
+ } else {
212
+ logger . debug ( `Build details not sent` )
213
+ }
193
214
}
194
215
195
216
let printInitialLog = ( ) => {
0 commit comments