1
1
"use strict" ;
2
+
3
+ const { util } = require ( "chai" ) ;
4
+
2
5
const request = require ( "request" ) ,
3
6
config = require ( "../config" ) ,
4
7
utils = require ( "../utils" ) ,
@@ -148,12 +151,6 @@ let whileProcess = (whilstCallback) => {
148
151
switch ( response . statusCode ) {
149
152
case 202 : // get data here and print it
150
153
n = 2
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
154
showSpecsStatus ( body , 202 ) ;
158
155
return setTimeout ( whilstCallback , timeout * n , null ) ;
159
156
case 204 : // No data available, wait for some time and ask again
@@ -162,12 +159,6 @@ let whileProcess = (whilstCallback) => {
162
159
case 200 : // Build is completed.
163
160
whileLoop = false ;
164
161
endTime = Date . now ( ) ;
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
162
showSpecsStatus ( body , 200 ) ;
172
163
return specSummary . exitCode == Constants . BUILD_FAILED_EXIT_CODE ?
173
164
whilstCallback ( { status : 204 , message : "No specs ran in the build" } ) : whilstCallback ( null , body ) ;
@@ -184,7 +175,7 @@ let getStackTraceUrl = () => {
184
175
185
176
let showSpecsStatus = ( data , statusCode ) => {
186
177
let specData = JSON . parse ( data ) ;
187
- specData [ "specDetails " ] . forEach ( specDetails => {
178
+ specData [ "specData " ] . forEach ( specDetails => {
188
179
if ( specDetails . type === Constants . CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY ) {
189
180
addCustomErrorToPrint ( specDetails ) ;
190
181
} else {
@@ -205,12 +196,14 @@ let showSpecsStatus = (data, statusCode) => {
205
196
} ) ;
206
197
if ( statusCode != 200 ) return ;
207
198
// 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` ) ;
199
+ if ( "buildData" in specData ) {
200
+ const buildDetails = specData . buildData ;
201
+ const totalDuration = buildDetails . duration ?. total_duration
202
+ const parallels = buildDetails . parallels
203
+ logger . info ( `Done in ${ totalDuration } seconds with ${ parallels } parallels.\n` ) ;
211
204
} else {
212
205
logger . debug ( `Build details not sent` )
213
- }
206
+ }
214
207
}
215
208
216
209
let printInitialLog = ( ) => {
0 commit comments