@@ -676,16 +676,14 @@ describe('utils', () => {
676
676
delete process . env . BROWSERSTACK_LOCAL ;
677
677
} ) ;
678
678
679
- it ( 'bsconfig connection_settings local_inferred as true if serachforOption returns false with args local-mode true' , ( ) => {
679
+ it ( 'bsconfig connection_settings local_inferred as true if args local-mode true' , ( ) => {
680
680
let bsConfig = {
681
681
connection_settings : {
682
682
}
683
683
} ;
684
684
let args = {
685
685
localMode : "always-on"
686
686
} ;
687
- let searchForOptionStub = sinon . stub ( utils , "searchForOption" ) ;
688
- searchForOptionStub . returns ( false ) ;
689
687
utils . setLocal ( bsConfig , args ) ;
690
688
expect ( bsConfig . connection_settings . local_inferred ) . to . be . eq ( true ) ;
691
689
} ) ;
@@ -726,14 +724,13 @@ describe('utils', () => {
726
724
expect ( bsConfig . connection_settings . local ) . to . be . eq ( false ) ;
727
725
} ) ;
728
726
729
- it ( 'should change local to true in bsConfig if process.env.BROWSERSTACK_LOCAL is set to true' , ( ) => {
727
+ it ( 'should change local to true in bsConfig if args.local is set to true' , ( ) => {
730
728
let bsConfig = {
731
729
connection_settings : {
732
730
local : false ,
733
731
} ,
734
732
} ;
735
- let args = { } ;
736
- process . env . BROWSERSTACK_LOCAL = true ;
733
+ let args = { local : true } ;
737
734
utils . setLocal ( bsConfig , args ) ;
738
735
expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
739
736
} ) ;
@@ -748,6 +745,19 @@ describe('utils', () => {
748
745
utils . setLocal ( bsConfig , args ) ;
749
746
expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
750
747
} ) ;
748
+
749
+ it ( 'should set local to true in bsConfig if local is passed as string in bsConfig' , ( ) => {
750
+ let bsConfig = {
751
+ connection_settings : {
752
+ local : "true"
753
+ } ,
754
+ } ;
755
+ let args = {
756
+ } ;
757
+ utils . setLocal ( bsConfig , args ) ;
758
+ expect ( bsConfig . connection_settings . local ) . to . be . eq ( true ) ;
759
+ } ) ;
760
+
751
761
} ) ;
752
762
753
763
describe ( 'setLocalMode' , ( ) => {
@@ -1428,6 +1438,23 @@ describe('utils', () => {
1428
1438
expect ( utils . isUndefined ( bsConfig . auth ) ) . to . be . true ;
1429
1439
expect ( utils . isUndefined ( bsConfig . run_settings . npm_dependencies ) ) . to . be . false ;
1430
1440
} ) ;
1441
+
1442
+ it ( 'should set connection_settings if bsConfig.connection_settings is undefined' , ( ) => {
1443
+ let bsConfig = { run_settings : { } } ;
1444
+ utils . setDefaults ( bsConfig , { } ) ;
1445
+ expect ( utils . isUndefined ( bsConfig . connection_settings ) ) . to . be . false ;
1446
+ } ) ;
1447
+
1448
+ it ( 'should not set connection_settings if bsConfig.connection_settings is defined ' , ( ) => {
1449
+ let bsConfig = {
1450
+ run_settings : { } ,
1451
+ connection_settings : {
1452
+ local : "false"
1453
+ }
1454
+ } ;
1455
+ utils . setDefaults ( bsConfig , { } ) ;
1456
+ expect ( bsConfig . connection_settings ) . to . deep . equal ( { local : "false" } ) ;
1457
+ } ) ;
1431
1458
} ) ;
1432
1459
1433
1460
describe ( 'getNumberOfSpecFiles' , ( ) => {
0 commit comments