File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ module.exports = function run(args) {
24
24
// accept the build name from command line if provided
25
25
utils . setBuildName ( bsConfig , args ) ;
26
26
27
+ // set cypress config filename
28
+ utils . setCypressConfigFilename ( bsConfig , args ) ;
29
+
27
30
// Validate browserstack.json values and parallels specified via arguments
28
31
return capabilityHelper . validate ( bsConfig , args ) . then ( function ( validated ) {
29
32
logger . info ( validated ) ;
Original file line number Diff line number Diff line change @@ -95,6 +95,26 @@ exports.setBuildName = (bsConfig, args) => {
95
95
}
96
96
}
97
97
98
+ exports . searchForOption = ( option ) => {
99
+ return ( process . argv . indexOf ( option ) > - 1 ) ;
100
+ }
101
+
102
+ exports . verifyCypressConfigFileOption = ( ) => {
103
+ let ccfOptionsSet = ( this . searchForOption ( '-ccf' ) || this . searchForOption ( '--ccf' ) ) ;
104
+ let cypressConfigFileSet = ( this . searchForOption ( '-cypress-config-file' ) || this . searchForOption ( '--cypress-config-file' ) ) ;
105
+ let cypressConfigOptionsSet = ( this . searchForOption ( '-cypressConfigFile' ) || this . searchForOption ( '--cypressConfigFile' ) ) ;
106
+ return ( ccfOptionsSet || cypressConfigFileSet || cypressConfigOptionsSet ) ;
107
+ }
108
+
109
+ exports . setCypressConfigFilename = ( bsConfig , args ) => {
110
+ let userPassedCypessConfigFile = this . verifyCypressConfigFileOption ( ) ;
111
+
112
+ if ( userPassedCypessConfigFile || this . isUndefined ( bsConfig . run_settings . cypress_config_file ) ) {
113
+ bsConfig . run_settings . cypress_config_filename = path . basename ( args . cypressConfigFile ) ;
114
+ bsConfig . run_settings . cypress_config_file = args . cypressConfigFile ;
115
+ }
116
+ }
117
+
98
118
exports . isUndefined = value => ( value === undefined || value === null ) ;
99
119
100
120
exports . isFloat = value => ( Number ( value ) && Number ( value ) % 1 !== 0 ) ;
You can’t perform that action at this time.
0 commit comments