@@ -7,6 +7,8 @@ const config = require("./config"),
77
88const uploadSuits = ( bsConfig , filePath , opts ) => {
99 return new Promise ( function ( resolve , reject ) {
10+ let startTime = Date . now ( ) ;
11+
1012 if ( opts . urlPresent ) {
1113 return resolve ( { [ opts . md5ReturnKey ] : opts . url } ) ;
1214 }
@@ -30,6 +32,7 @@ const uploadSuits = (bsConfig, filePath, opts) => {
3032 if ( resp . statusCode != 200 ) {
3133 if ( resp . statusCode == 401 ) {
3234 if ( responseData && responseData [ "error" ] ) {
35+ responseData [ "time" ] = Date . now ( ) - startTime ;
3336 return reject ( responseData [ "error" ] ) ;
3437 } else {
3538 return reject ( Constants . validationMessages . INVALID_DEFAULT_AUTH_PARAMS ) ;
@@ -39,6 +42,7 @@ const uploadSuits = (bsConfig, filePath, opts) => {
3942 return resolve ( { } ) ;
4043 }
4144 if ( responseData && responseData [ "error" ] ) {
45+ responseData [ "time" ] = Date . now ( ) - startTime ;
4246 reject ( responseData [ "error" ] ) ;
4347 } else {
4448 if ( resp . statusCode == 413 ) {
@@ -50,6 +54,7 @@ const uploadSuits = (bsConfig, filePath, opts) => {
5054 } else {
5155 logger . info ( `${ opts . messages . uploadingSuccess } (${ responseData [ opts . md5ReturnKey ] } )` ) ;
5256 opts . cleanupMethod ( ) ;
57+ responseData [ "time" ] = Date . now ( ) - startTime ;
5358 resolve ( responseData ) ;
5459 }
5560 }
@@ -66,12 +71,20 @@ const uploadCypressZip = (bsConfig, md5data, packageData) => {
6671 let zipUpload = uploadSuits ( bsConfig , config . fileName , zipOptions ) ;
6772 let npmPackageUpload = uploadSuits ( bsConfig , config . packageFileName , npmOptions ) ;
6873 Promise . all ( [ zipUpload , npmPackageUpload ] ) . then ( function ( uploads ) {
69- uploads . forEach ( upload => Object . assign ( obj , upload ) )
74+ uploads . forEach ( upload => {
75+ if ( upload . zip_url && upload . time ) {
76+ upload . tests_upload_time = upload . time ;
77+ } else if ( upload . npm_package_url && upload . time ) {
78+ upload . npm_package_upload_time = upload . time ;
79+ }
80+ delete upload . time ;
81+ Object . assign ( obj , upload ) ;
82+ } ) ;
7083 return resolve ( obj ) ;
7184 } ) . catch ( ( error ) => {
7285 return reject ( error ) ;
7386 } )
7487 } )
7588}
7689
77- exports . zipUpload = uploadCypressZip
90+ exports . zipUpload = uploadCypressZip ;
0 commit comments