Skip to content

Commit

Permalink
Merge pull request #73 from browserstack/info-and-stop-fix
Browse files Browse the repository at this point in the history
Fixing the path issue for info, init, and stop for usage reporting
  • Loading branch information
suryart authored Oct 14, 2020
2 parents f9e3860 + dfd0329 commit daf2106
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions bin/commands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = function info(args) {

utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);

// set cypress config filename
utils.setCypressConfigFilename(bsConfig, args);

let buildId = args._[1];

let options = {
Expand Down
2 changes: 2 additions & 0 deletions bin/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ function get_path(args) {
if (filename !== path.basename(filename)) {
let message = Constants.userMessages.CONFLICTING_INIT_ARGUMENTS;
logger.error(message);
// set cypress config filename
utils.setCypressConfigFilename(args.bstack_config, args);
utils.sendUsageReport(null, args, message, Constants.messageTypes.ERROR, 'conflicting_path_json_init');
return;
}
Expand Down
3 changes: 3 additions & 0 deletions bin/commands/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = function stop(args) {

utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);

// set cypress config filename
utils.setCypressConfigFilename(bsConfig, args);

let buildId = args._[1];

let options = {
Expand Down
4 changes: 2 additions & 2 deletions bin/helpers/usageReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function local_cypress_version(bsConfig) {
// 1. check version of Cypress installed in local project
// 2. check version of Cypress installed globally if not present in project

if (bsConfig) {
if (bsConfig && bsConfig.run_settings.cypressProjectDir) {
let version = get_version(path.join(bsConfig.run_settings.cypressProjectDir, 'node_modules', '.bin', 'cypress'));
if (!version) {
version = get_version('cypress');
Expand Down Expand Up @@ -80,7 +80,7 @@ function cli_version_and_path(bsConfig) {
// 1. check version of Cypress installed in local project
// 2. check version of Cypress installed globally if not present in project

if (bsConfig) {
if (bsConfig && bsConfig.run_settings.cypressProjectDir) {
let _path = path.join(bsConfig.run_settings.cypressProjectDir, 'node_modules', 'browserstack-cypress');
let version = get_version(_path);
if (!version) {
Expand Down
2 changes: 1 addition & 1 deletion bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ exports.setCypressConfigFilename = (bsConfig, args) => {

bsConfig.run_settings.userProvidedCypessConfigFile = (userProvidedCypessConfigFile || (!this.isUndefined(bsConfig.run_settings.cypress_config_file)));

if (userProvidedCypessConfigFile || this.isUndefined(bsConfig.run_settings.cypress_config_file)) {
if ((userProvidedCypessConfigFile || this.isUndefined(bsConfig.run_settings.cypress_config_file)) && !this.isUndefined(args.cypressConfigFile)) {
bsConfig.run_settings.cypress_config_file = args.cypressConfigFile;
bsConfig.run_settings.cypress_config_filename = path.basename(args.cypressConfigFile);
} else if (!this.isUndefined(bsConfig.run_settings.cypress_config_file)) {
Expand Down

0 comments on commit daf2106

Please sign in to comment.