Skip to content

Commit 23f13d7

Browse files
committed
Merged master
2 parents 38146ed + 99e2205 commit 23f13d7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const 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

57
const 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
}

bin/helpers/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

3032
const cliMessages = {

0 commit comments

Comments
 (0)