File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11const logger = require ( "./logger" ) . winstonLogger ,
22 Constants = require ( "./constants" ) ,
3- Utils = require ( "./utils" ) ;
3+ Utils = require ( "./utils" ) ,
4+ fs = require ( 'fs' ) ,
5+ path = require ( 'path' ) ;
46
57const caps = ( bsConfig , zip ) => {
68 return new Promise ( function ( resolve , reject ) {
@@ -101,6 +103,15 @@ const validate = (bsConfig, args) => {
101103 // if parallels specified via arguments validate only arguments
102104 if ( ! Utils . isUndefined ( args ) && ! Utils . isUndefined ( args . parallels ) && ! Utils . isParallelValid ( args . parallels ) ) reject ( Constants . validationMessages . INVALID_PARALLELS_CONFIGURATION ) ;
103105
106+ if ( ! fs . existsSync ( path . join ( bsConfig . run_settings . cypress_proj_dir , 'cypress.json' ) ) ) reject ( Constants . validationMessages . CYPRESS_JSON_NOT_FOUND + bsConfig . run_settings . cypress_proj_dir ) ;
107+
108+ try {
109+ let cypressJson = fs . readFileSync ( path . join ( bsConfig . run_settings . cypress_proj_dir , 'cypress.json' ) )
110+ JSON . parse ( cypressJson )
111+ } catch ( error ) {
112+ reject ( Constants . validationMessages . INVALID_CYPRESS_JSON )
113+ }
114+
104115 resolve ( Constants . validationMessages . VALIDATED ) ;
105116 } ) ;
106117}
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ const validationMessages = {
2525 NOT_VALID_JSON : "browerstack.json is not a valid json" ,
2626 INVALID_EXTENSION : "Invalid files, please remove these files and try again." ,
2727 INVALID_PARALLELS_CONFIGURATION : "Invalid value specified for parallels to use. Maximum parallels to use should be a number greater than 0." ,
28+ CYPRESS_JSON_NOT_FOUND : "cypress.json file is not found at cypress_proj_dir path " ,
29+ INVALID_CYPRESS_JSON : "cypress.json is not a valid json"
2830} ;
2931
3032const cliMessages = {
You can’t perform that action at this time.
0 commit comments