@@ -1292,29 +1292,28 @@ exports.setConfig = (bsConfig, args) => {
1292
1292
1293
1293
// set configs if enforce_settings is passed
1294
1294
exports . 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 ;
1296
1297
if ( this . isUndefined ( config_args ) || ! config_args . includes ( "video" ) ) {
1297
1298
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' ;
1298
1299
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' ;
1299
1300
config_args = this . isUndefined ( config_args ) ? video_args : config_args + ',' + video_args ;
1300
1301
logger . debug ( `Setting video_args for enforce_settings to ${ video_args } ` ) ;
1301
1302
}
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" ) ) ) {
1303
1304
let base_url_args = 'baseUrl=' + bsConfig . run_settings . baseUrl ;
1304
1305
config_args = this . isUndefined ( config_args ) ? base_url_args : config_args + ',' + base_url_args ;
1305
1306
logger . debug ( `Setting base_url_args for enforce_settings to ${ base_url_args } ` ) ;
1306
1307
}
1307
1308
// 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.
1309
1311
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
- }
1313
1312
config_args = this . isUndefined ( config_args ) ? spec_pattern_args : config_args + ',' + spec_pattern_args ;
1314
1313
}
1315
- if ( ! this . isUndefined ( config_args ) ) bsConfig [ "run_settings" ] [ "config" ] = config_args ;
1314
+ if ( this . isNotUndefined ( config_args ) ) bsConfig [ "run_settings" ] [ "config" ] = config_args ;
1316
1315
logger . debug ( `Setting conifg_args for enforce_settings to ${ config_args } ` ) ;
1317
- }
1316
+ }
1318
1317
1319
1318
// blindly send other passed configs with run_settings and handle at backend
1320
1319
exports . setOtherConfigs = ( bsConfig , args ) => {
0 commit comments