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) {
2424 // accept the build name from command line if provided
2525 utils . setBuildName ( bsConfig , args ) ;
2626
27+ // set cypress config filename
28+ utils . setCypressConfigFilename ( bsConfig , args ) ;
29+
2730 // Validate browserstack.json values and parallels specified via arguments
2831 return capabilityHelper . validate ( bsConfig , args ) . then ( function ( validated ) {
2932 logger . info ( validated ) ;
Original file line number Diff line number Diff line change @@ -95,6 +95,26 @@ exports.setBuildName = (bsConfig, args) => {
9595 }
9696}
9797
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+
98118exports . isUndefined = value => ( value === undefined || value === null ) ;
99119
100120exports . isFloat = value => ( Number ( value ) && Number ( value ) % 1 !== 0 ) ;
You can’t perform that action at this time.
0 commit comments