Skip to content

Commit 15de10a

Browse files
Warning message in case of local_mode is invalid
1 parent c56466d commit 15de10a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ const caps = (bsConfig, zip) => {
6868
// Local Mode
6969
if (obj.local === true && bsConfig.connection_settings.local_mode) {
7070
obj.localMode = bsConfig.connection_settings.local_mode;
71+
if (bsConfig.connection_settings.user_defined_local_mode_warning) {
72+
logger.warn(Constants.userMessages.INVALID_LOCAL_MODE_WARNING);
73+
}
7174
logger.info(`Local testing set up in ${obj.localMode} mode.`);
7275
}
7376

bin/helpers/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const userMessages = {
3939
CHECK_DASHBOARD_AT: "Please check the build status at: ",
4040
CYPRESS_VERSION_CHANGED: "Your build will run using Cypress <actualVersion> instead of Cypress <preferredVersion>. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions",
4141
LOCAL_START_FAILED: "Local Testing setup failed.",
42-
LOCAL_STOP_FAILED: "Local Binary stop failed."
42+
LOCAL_STOP_FAILED: "Local Binary stop failed.",
43+
INVALID_LOCAL_MODE_WARNING: "Invalid value specified for local_mode. local_mode: (\"always-on\" | \"on-demand\"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference"
4344
};
4445

4546
const validationMessages = {

bin/helpers/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ exports.setLocalMode = (bsConfig, args) => {
386386

387387
if (!this.isUndefined(args.localMode) && args.localMode == 'always-on') {
388388
local_mode = 'always-on';
389+
} else if (!localModeUndefined && !["always-on", "on-demand"].includes(bsConfig['connection_settings']['local_mode'])) {
390+
bsConfig.connection_settings.user_defined_local_mode_warning = bsConfig['connection_settings']['local_mode'];
389391
} else if (
390392
!this.isUndefined(bsConfig['connection_settings']['local_mode']) &&
391393
String(bsConfig['connection_settings']['local_mode']).toLowerCase() ===

0 commit comments

Comments
 (0)