@@ -1292,29 +1292,28 @@ exports.setConfig = (bsConfig, args) => {
12921292
12931293// set configs if enforce_settings is passed
12941294exports . setEnforceSettingsConfig = ( bsConfig ) => {
1295- let config_args = ( ! this . isUndefined ( bsConfig ) && ! this . isUndefined ( bsConfig . run_settings ) && ! this . isUndefined ( bsConfig . run_settings . config ) ) ? bsConfig . run_settings . config : undefined ;
1295+ if ( this . isUndefined ( bsConfig ) || this . isUndefined ( bsConfig . run_settings ) ) return ;
1296+ let config_args = ( bsConfig && bsConfig . run_settings && bsConfig . run_settings . config ) ? bsConfig . run_settings . config : undefined ;
12961297 if ( this . isUndefined ( config_args ) || ! config_args . includes ( "video" ) ) {
12971298 let video_args = ( this . isUndefined ( bsConfig . run_settings . video_config ) || this . isUndefined ( bsConfig . run_settings . video_config . video ) || ! bsConfig . run_settings . video_config . video ) ? 'video=false' : 'video=true' ;
12981299 video_args += ( this . isUndefined ( bsConfig . run_settings . video_config ) || this . isUndefined ( bsConfig . run_settings . video_config . videoUploadOnPasses ) || ! bsConfig . run_settings . video_config . videoUploadOnPasses ) ? ',videoUploadOnPasses=false' : ',videoUploadOnPasses=true' ;
12991300 config_args = this . isUndefined ( config_args ) ? video_args : config_args + ',' + video_args ;
13001301 logger . debug ( `Setting video_args for enforce_settings to ${ video_args } ` ) ;
13011302 }
1302- if ( ( ! this . isUndefined ( bsConfig ) && ! this . isUndefined ( bsConfig . run_settings ) && ! this . isUndefined ( bsConfig . run_settings . baseUrl ) ) && ( this . isUndefined ( config_args ) || ! config_args . includes ( "baseUrl" ) ) ) {
1303+ if ( ( bsConfig && bsConfig . run_settings && bsConfig . run_settings . baseUrl ) && ( this . isUndefined ( config_args ) || ! config_args . includes ( "baseUrl" ) ) ) {
13031304 let base_url_args = 'baseUrl=' + bsConfig . run_settings . baseUrl ;
13041305 config_args = this . isUndefined ( config_args ) ? base_url_args : config_args + ',' + base_url_args ;
13051306 logger . debug ( `Setting base_url_args for enforce_settings to ${ base_url_args } ` ) ;
13061307 }
13071308 // set specs in config of specpattern to override cypress config
1308- if ( ! this . isUndefined ( bsConfig ) && ! this . isUndefined ( bsConfig . run_settings ) && ! this . isUndefined ( bsConfig . run_settings . specs ) ) {
1309+ if ( this . isNotUndefined ( bsConfig . run_settings . specs ) && bsConfig . run_settings . cypressTestSuiteType === Constants . CYPRESS_V10_AND_ABOVE_TYPE ) {
1310+ // doing this only for cypress 10 and above as --spec is given precedence for cypress 9.
13091311 let spec_pattern_args = 'specPattern="' + bsConfig . run_settings . specs + '"' ;
1310- if ( bsConfig . run_settings . cypressTestSuiteType !== Constants . CYPRESS_V10_AND_ABOVE_TYPE ) {
1311- spec_pattern_args = 'testFiles="' + bsConfig . run_settings . specs + '"' ;
1312- }
13131312 config_args = this . isUndefined ( config_args ) ? spec_pattern_args : config_args + ',' + spec_pattern_args ;
13141313 }
1315- if ( ! this . isUndefined ( config_args ) ) bsConfig [ "run_settings" ] [ "config" ] = config_args ;
1314+ if ( this . isNotUndefined ( config_args ) ) bsConfig [ "run_settings" ] [ "config" ] = config_args ;
13161315 logger . debug ( `Setting conifg_args for enforce_settings to ${ config_args } ` ) ;
1317- }
1316+ }
13181317
13191318// blindly send other passed configs with run_settings and handle at backend
13201319exports . setOtherConfigs = ( bsConfig , args ) => {
0 commit comments