File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ exports.getLocalFlag = (connectionSettings) => {
173
173
}
174
174
175
175
exports . setLocal = ( bsConfig ) => {
176
- if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL ) && ! this . isUndefined ( bsConfig . connection_settings ) ) {
176
+ if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL ) ) {
177
177
let local = false ;
178
178
if ( String ( process . env . BROWSERSTACK_LOCAL ) . toLowerCase ( ) === "true" ) local = true ;
179
179
bsConfig [ 'connection_settings' ] [ 'local' ] = local ;
@@ -182,7 +182,7 @@ exports.setLocal = (bsConfig) => {
182
182
}
183
183
184
184
exports . setLocalIdentifier = ( bsConfig ) => {
185
- if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL_IDENTIFIER ) && ! this . isUndefined ( bsConfig . connection_settings ) ) {
185
+ if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL_IDENTIFIER ) ) {
186
186
bsConfig [ 'connection_settings' ] [ 'local_identifier' ] = process . env . BROWSERSTACK_LOCAL_IDENTIFIER ;
187
187
logger . info ( "Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER" ) ;
188
188
}
Original file line number Diff line number Diff line change @@ -344,6 +344,17 @@ describe("utils", () => {
344
344
utils . setLocal ( bsConfig ) ;
345
345
expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
346
346
} ) ;
347
+
348
+ it ( "should set local to true in bsConfig if process.env.BROWSERSTACK_LOCAL is set to true & local is not set in bsConfig" , ( ) => {
349
+ let bsConfig = {
350
+ connection_settings : {
351
+ }
352
+ }
353
+ process . env . BROWSERSTACK_LOCAL = true ;
354
+ utils . setLocal ( bsConfig ) ;
355
+ expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
356
+ } ) ;
357
+
347
358
} ) ;
348
359
349
360
describe ( "setLocalIdentifier" , ( ) => {
@@ -375,6 +386,16 @@ describe("utils", () => {
375
386
expect ( bsConfig . connection_settings . local_identifier ) . to . be . eq ( "local_identifier" ) ;
376
387
} ) ;
377
388
389
+ it ( "should set local identifier in connection_settings in bsConfig if process.env.BROWSERSTACK_LOCAL_IDENTIFIER is present & not set in bsConfig" , ( ) => {
390
+ let bsConfig = {
391
+ connection_settings : {
392
+ }
393
+ }
394
+ process . env . BROWSERSTACK_LOCAL_IDENTIFIER = "local_identifier" ;
395
+ utils . setLocalIdentifier ( bsConfig ) ;
396
+ expect ( bsConfig . connection_settings . local_identifier ) . to . be . eq ( "local_identifier" ) ;
397
+ } ) ;
398
+
378
399
} ) ;
379
400
380
401
describe ( "setUsername" , ( ) => {
You can’t perform that action at this time.
0 commit comments