11"use strict" ;
2+
3+ const { util } = require ( "chai" ) ;
4+
25const request = require ( "request" ) ,
36 config = require ( "../config" ) ,
47 utils = require ( "../utils" ) ,
@@ -148,12 +151,6 @@ let whileProcess = (whilstCallback) => {
148151 switch ( response . statusCode ) {
149152 case 202 : // get data here and print it
150153 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- // }
157154 showSpecsStatus ( body , 202 ) ;
158155 return setTimeout ( whilstCallback , timeout * n , null ) ;
159156 case 204 : // No data available, wait for some time and ask again
@@ -162,12 +159,6 @@ let whileProcess = (whilstCallback) => {
162159 case 200 : // Build is completed.
163160 whileLoop = false ;
164161 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- // }
171162 showSpecsStatus ( body , 200 ) ;
172163 return specSummary . exitCode == Constants . BUILD_FAILED_EXIT_CODE ?
173164 whilstCallback ( { status : 204 , message : "No specs ran in the build" } ) : whilstCallback ( null , body ) ;
@@ -184,7 +175,7 @@ let getStackTraceUrl = () => {
184175
185176let showSpecsStatus = ( data , statusCode ) => {
186177 let specData = JSON . parse ( data ) ;
187- specData [ "specDetails " ] . forEach ( specDetails => {
178+ specData [ "specData " ] . forEach ( specDetails => {
188179 if ( specDetails . type === Constants . CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY ) {
189180 addCustomErrorToPrint ( specDetails ) ;
190181 } else {
@@ -205,12 +196,14 @@ let showSpecsStatus = (data, statusCode) => {
205196 } ) ;
206197 if ( statusCode != 200 ) return ;
207198 // 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` ) ;
211204 } else {
212205 logger . debug ( `Build details not sent` )
213- }
206+ }
214207}
215208
216209let printInitialLog = ( ) => {
0 commit comments