Skip to content

Commit daf2106

Browse files
authored
Merge pull request #73 from browserstack/info-and-stop-fix
Fixing the path issue for info, init, and stop for usage reporting
2 parents f9e3860 + dfd0329 commit daf2106

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

bin/commands/info.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = function info(args) {
1818

1919
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
2020

21+
// set cypress config filename
22+
utils.setCypressConfigFilename(bsConfig, args);
23+
2124
let buildId = args._[1];
2225

2326
let options = {

bin/commands/init.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ function get_path(args) {
1313
if (filename !== path.basename(filename)) {
1414
let message = Constants.userMessages.CONFLICTING_INIT_ARGUMENTS;
1515
logger.error(message);
16+
// set cypress config filename
17+
utils.setCypressConfigFilename(args.bstack_config, args);
1618
utils.sendUsageReport(null, args, message, Constants.messageTypes.ERROR, 'conflicting_path_json_init');
1719
return;
1820
}

bin/commands/stop.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = function stop(args) {
1818

1919
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
2020

21+
// set cypress config filename
22+
utils.setCypressConfigFilename(bsConfig, args);
23+
2124
let buildId = args._[1];
2225

2326
let options = {

bin/helpers/usageReporting.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function local_cypress_version(bsConfig) {
3333
// 1. check version of Cypress installed in local project
3434
// 2. check version of Cypress installed globally if not present in project
3535

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

83-
if (bsConfig) {
83+
if (bsConfig && bsConfig.run_settings.cypressProjectDir) {
8484
let _path = path.join(bsConfig.run_settings.cypressProjectDir, 'node_modules', 'browserstack-cypress');
8585
let version = get_version(_path);
8686
if (!version) {

bin/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ exports.setCypressConfigFilename = (bsConfig, args) => {
164164

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

167-
if (userProvidedCypessConfigFile || this.isUndefined(bsConfig.run_settings.cypress_config_file)) {
167+
if ((userProvidedCypessConfigFile || this.isUndefined(bsConfig.run_settings.cypress_config_file)) && !this.isUndefined(args.cypressConfigFile)) {
168168
bsConfig.run_settings.cypress_config_file = args.cypressConfigFile;
169169
bsConfig.run_settings.cypress_config_filename = path.basename(args.cypressConfigFile);
170170
} else if (!this.isUndefined(bsConfig.run_settings.cypress_config_file)) {

0 commit comments

Comments
 (0)