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
- Constants = require ( "./constants" ) ;
2
+ Constants = require ( "./constants" ) ,
3
+ fs = require ( 'fs' ) ,
4
+ path = require ( 'path' ) ;
3
5
4
6
const caps = ( bsConfig , zip ) => {
5
7
return new Promise ( function ( resolve , reject ) {
@@ -91,6 +93,15 @@ const validate = (bsConfig) => {
91
93
92
94
if ( ! bsConfig . run_settings . cypress_proj_dir ) reject ( Constants . validationMessages . EMPTY_SPEC_FILES ) ;
93
95
96
+ 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 ) ;
97
+
98
+ try {
99
+ let cypressJson = fs . readFileSync ( path . join ( bsConfig . run_settings . cypress_proj_dir , 'cypress.json' ) )
100
+ JSON . parse ( cypressJson )
101
+ } catch ( error ) {
102
+ reject ( Constants . validationMessages . INVALID_CYPRESS_JSON )
103
+ }
104
+
94
105
resolve ( Constants . validationMessages . VALIDATED ) ;
95
106
} ) ;
96
107
}
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ const validationMessages = {
24
24
NOT_VALID : "browerstack.json is not valid" ,
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
+ CYPRESS_JSON_NOT_FOUND : "cypress.json file is not found at cypress_proj_dir path " ,
28
+ INVALID_CYPRESS_JSON : "cypress.json is not a valid json"
27
29
} ;
28
30
29
31
const cliMessages = {
You can’t perform that action at this time.
0 commit comments