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) => {
173173}
174174
175175exports . setLocal = ( bsConfig ) => {
176- if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL ) && ! this . isUndefined ( bsConfig . connection_settings ) ) {
176+ if ( ! this . isUndefined ( process . env . BROWSERSTACK_LOCAL ) ) {
177177 let local = false ;
178178 if ( String ( process . env . BROWSERSTACK_LOCAL ) . toLowerCase ( ) === "true" ) local = true ;
179179 bsConfig [ 'connection_settings' ] [ 'local' ] = local ;
@@ -182,7 +182,7 @@ exports.setLocal = (bsConfig) => {
182182}
183183
184184exports . 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 ) ) {
186186 bsConfig [ 'connection_settings' ] [ 'local_identifier' ] = process . env . BROWSERSTACK_LOCAL_IDENTIFIER ;
187187 logger . info ( "Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER" ) ;
188188 }
Original file line number Diff line number Diff line change @@ -344,6 +344,17 @@ describe("utils", () => {
344344 utils . setLocal ( bsConfig ) ;
345345 expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
346346 } ) ;
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+
347358 } ) ;
348359
349360 describe ( "setLocalIdentifier" , ( ) => {
@@ -375,6 +386,16 @@ describe("utils", () => {
375386 expect ( bsConfig . connection_settings . local_identifier ) . to . be . eq ( "local_identifier" ) ;
376387 } ) ;
377388
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+
378399 } ) ;
379400
380401 describe ( "setUsername" , ( ) => {
You can’t perform that action at this time.
0 commit comments