1
1
const logger = require ( "./logger" ) . winstonLogger ,
2
- Constants = require ( "./constants" ) ;
2
+ Constants = require ( "./constants" ) ,
3
+ Util = require ( "./util" ) ;
3
4
4
5
const caps = ( bsConfig , zip ) => {
5
6
return new Promise ( function ( resolve , reject ) {
@@ -61,7 +62,7 @@ const caps = (bsConfig, zip) => {
61
62
} )
62
63
}
63
64
64
- const validate = ( bsConfig ) => {
65
+ const validate = ( bsConfig , args ) => {
65
66
return new Promise ( function ( resolve , reject ) {
66
67
if ( ! bsConfig ) reject ( Constants . validationMessages . EMPTY_BROWSERSTACK_JSON ) ;
67
68
@@ -71,7 +72,15 @@ const validate = (bsConfig) => {
71
72
72
73
if ( ! bsConfig . run_settings ) reject ( Constants . validationMessages . EMPTY_RUN_SETTINGS ) ;
73
74
74
- if ( ! bsConfig . run_settings . cypress_proj_dir ) reject ( Constants . validationMessages . EMPTY_SPEC_FILES ) ;
75
+ if ( ! bsConfig . run_settings . cypress_proj_dir ) reject ( Constants . validationMessages . EMPTY_SPEC_FILES ) ;
76
+
77
+ // validate parallels specified in browserstack.json if parallels are not specified via arguments
78
+ if ( Util . isUndefined ( args . parallels ) && ! Util . isParallelValid ( bsConfig . run_settings . parallels ) ) {
79
+ reject ( Constants . validationMessages . INVALID_PARALLES_CONFIGURATION ) ;
80
+ }
81
+ // if parallels specified via arguments validate both parallels specifed in browserstack.json and parallels specified in arguments
82
+ if ( ! Util . isUndefined ( args . parallels ) && ! Util . isParallelValid ( args . parallels ) ) reject ( Constants . validationMessages . INVALID_PARALLES_CONFIGURATION ) ;
83
+
75
84
76
85
resolve ( Constants . validationMessages . VALIDATED ) ;
77
86
} ) ;
0 commit comments