Skip to content

Commit a5f2cde

Browse files
Adding validation to check if cypress.json is present at the cypress_proj_dir.
1 parent 2b0afa0 commit a5f2cde

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const logger = require("./logger").winstonLogger,
2-
Constants = require("./constants");
2+
Constants = require("./constants"),
3+
fs = require('fs'),
4+
path = require('path');
35

46
const caps = (bsConfig, zip) => {
57
return new Promise(function (resolve, reject) {
@@ -91,6 +93,8 @@ const validate = (bsConfig) => {
9193

9294
if(!bsConfig.run_settings.cypress_proj_dir) reject(Constants.validationMessages.EMPTY_SPEC_FILES);
9395

96+
if (!fs.existsSync(path.join(process.cwd(), bsConfig.run_settings.cypress_proj_dir, 'cypress.json'))) reject(Constants.validationMessages.EMPTY_CYPRESS_JSON);
97+
9498
resolve(Constants.validationMessages.VALIDATED);
9599
});
96100
}

bin/helpers/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const validationMessages = {
2424
NOT_VALID: "browerstack.json is not valid",
2525
NOT_VALID_JSON: "browerstack.json is not a valid json",
2626
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"
2728
};
2829

2930
const cliMessages = {

0 commit comments

Comments
 (0)