Skip to content

Commit eb75a45

Browse files
Fixed local_mode not set to always-on when local_identifier is supplied in browserstack.json
1 parent a8ebf1e commit eb75a45

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

bin/helpers/utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ exports.setLocalIdentifier = (bsConfig, args) => {
362362
"Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER"
363363
);
364364
bsConfig['connection_settings']['local_mode'] = 'always-on';
365+
} else if (
366+
bsConfig['connection_settings']['local'] &&
367+
!this.isUndefined(bsConfig["connection_settings"]["local_identifier"])
368+
){
369+
bsConfig['connection_settings']['local_mode'] = 'always-on';
365370
} else if (
366371
bsConfig['connection_settings']['local'] &&
367372
this.isUndefined(bsConfig["connection_settings"]["local_identifier"])

test/unit/bin/helpers/utils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,19 @@ describe('utils', () => {
11141114
utils.setLocalIdentifier(bsConfig, args);
11151115
expect(bsConfig.connection_settings.local_identifier).to.be.eq("xyz");
11161116
expect(bsConfig.connection_settings.local_mode).to.be.eq('always-on');
1117+
});
11171118

1119+
it('if localIdentifier is defined then local_mode is set to always-on' , () => {
1120+
let bsConfig = {
1121+
connection_settings: {
1122+
local: true,
1123+
local_identifier: 'abc',
1124+
},
1125+
};
1126+
let args = {}
1127+
utils.setLocalIdentifier(bsConfig, args);
1128+
expect(bsConfig.connection_settings.local_identifier).to.be.eq("abc");
1129+
expect(bsConfig['connection_settings']['local_mode']).to.be.eq('always-on');
11181130
});
11191131
});
11201132

0 commit comments

Comments
 (0)