@@ -8,7 +8,7 @@ const archiver = require("../helpers/archiver"),
8
8
config = require ( "../helpers/config" ) ,
9
9
capabilityHelper = require ( "../helpers/capabilityHelper" ) ,
10
10
Constants = require ( "../helpers/constants" ) ,
11
- util = require ( "../helpers/util " ) ;
11
+ utils = require ( "../helpers/utils " ) ;
12
12
13
13
module . exports = function run ( args ) {
14
14
return runCypress ( args ) ;
@@ -27,8 +27,8 @@ function deleteZip() {
27
27
function runCypress ( args ) {
28
28
let bsConfigPath = process . cwd ( ) + args . cf ;
29
29
30
- util . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
31
- util . setUsageReportingFlag ( bsConfig , args . disableUsageReporting ) ;
30
+ utils . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
31
+ utils . setUsageReportingFlag ( bsConfig , args . disableUsageReporting ) ;
32
32
33
33
// Validate browserstack.json values
34
34
capabilityHelper . validate ( bsConfig ) . then ( function ( validated ) {
@@ -43,43 +43,43 @@ function runCypress(args) {
43
43
// Create build
44
44
build . createBuild ( bsConfig , zip ) . then ( function ( message ) {
45
45
logger . info ( message ) ;
46
- util . sendUsageReport ( bsConfig , args , message , Constants . messageTypes . SUCCESS , null ) ;
46
+ utils . sendUsageReport ( bsConfig , args , message , Constants . messageTypes . SUCCESS , null ) ;
47
47
return ;
48
48
} ) . catch ( function ( err ) {
49
49
// Build creation failed
50
50
logger . error ( err ) ;
51
- util . sendUsageReport ( bsConfig , args , err , Constants . messageTypes . ERROR , 'build_failed' ) ;
51
+ utils . sendUsageReport ( bsConfig , args , err , Constants . messageTypes . ERROR , 'build_failed' ) ;
52
52
} ) ;
53
53
} ) . catch ( function ( err ) {
54
54
// Zip Upload failed
55
55
logger . error ( err )
56
56
logger . error ( Constants . userMessages . ZIP_UPLOAD_FAILED )
57
- util . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . userMessages . ZIP_UPLOAD_FAILED } ` , Constants . messageTypes . ERROR , 'zip_upload_failed' ) ;
57
+ utils . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . userMessages . ZIP_UPLOAD_FAILED } ` , Constants . messageTypes . ERROR , 'zip_upload_failed' ) ;
58
58
} ) . finally ( function ( ) {
59
59
deleteZip ( ) ;
60
60
} ) ;
61
61
} ) . catch ( function ( err ) {
62
62
// Zipping failed
63
63
logger . error ( err ) ;
64
64
logger . error ( Constants . userMessages . FAILED_TO_ZIP ) ;
65
- util . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . userMessages . FAILED_TO_ZIP } ` , Constants . messageTypes . ERROR , 'zip_creation_failed' ) ;
65
+ utils . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . userMessages . FAILED_TO_ZIP } ` , Constants . messageTypes . ERROR , 'zip_creation_failed' ) ;
66
66
try {
67
67
deleteZip ( ) ;
68
68
} catch ( err ) {
69
- util . sendUsageReport ( bsConfig , args , Constants . userMessages . ZIP_DELETE_FAILED , Constants . messageTypes . ERROR , 'zip_deletion_failed' ) ;
69
+ utils . sendUsageReport ( bsConfig , args , Constants . userMessages . ZIP_DELETE_FAILED , Constants . messageTypes . ERROR , 'zip_deletion_failed' ) ;
70
70
}
71
71
} ) ;
72
72
} ) . catch ( function ( err ) {
73
73
// browerstack.json is not valid
74
74
logger . error ( err ) ;
75
75
logger . error ( Constants . validationMessages . NOT_VALID ) ;
76
76
77
- let error_code = util . getErrorCodeFromMsg ( err ) ;
78
- util . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . validationMessages . NOT_VALID } ` , Constants . messageTypes . ERROR , error_code ) ;
77
+ let error_code = utils . getErrorCodeFromMsg ( err ) ;
78
+ utils . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . validationMessages . NOT_VALID } ` , Constants . messageTypes . ERROR , error_code ) ;
79
79
} ) ;
80
80
} ) . catch ( function ( err ) {
81
81
logger . error ( err ) ;
82
- util . setUsageReportingFlag ( null , args . disableUsageReporting ) ;
83
- util . sendUsageReport ( null , args , err . message , Constants . messageTypes . ERROR , util . getErrorCodeFromErr ( err ) ) ;
82
+ utils . setUsageReportingFlag ( null , args . disableUsageReporting ) ;
83
+ utils . sendUsageReport ( null , args , err . message , Constants . messageTypes . ERROR , utils . getErrorCodeFromErr ( err ) ) ;
84
84
} )
85
85
}
0 commit comments