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 1
1
const logger = require ( "./logger" ) . winstonLogger ,
2
2
Constants = require ( "./constants" ) ,
3
- Utils = require ( "./utils" ) ;
3
+ Utils = require ( "./utils" ) ,
4
+ fs = require ( 'fs' ) ,
5
+ path = require ( 'path' ) ;
4
6
5
7
const caps = ( bsConfig , zip ) => {
6
8
return new Promise ( function ( resolve , reject ) {
@@ -101,6 +103,15 @@ const validate = (bsConfig, args) => {
101
103
// if parallels specified via arguments validate only arguments
102
104
if ( ! Utils . isUndefined ( args ) && ! Utils . isUndefined ( args . parallels ) && ! Utils . isParallelValid ( args . parallels ) ) reject ( Constants . validationMessages . INVALID_PARALLELS_CONFIGURATION ) ;
103
105
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
+
104
115
resolve ( Constants . validationMessages . VALIDATED ) ;
105
116
} ) ;
106
117
}
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ const validationMessages = {
25
25
NOT_VALID_JSON : "browerstack.json is not a valid json" ,
26
26
INVALID_EXTENSION : "Invalid files, please remove these files and try again." ,
27
27
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"
28
30
} ;
29
31
30
32
const cliMessages = {
You can’t perform that action at this time.
0 commit comments