@@ -962,11 +962,20 @@ describe("capabilityHelper.js", () => {
962
962
run_settings : {
963
963
cypress_proj_dir : "random path" ,
964
964
cypressConfigFilePath : "random path" ,
965
- cypressProjectDir : "random path"
965
+ cypressProjectDir : "random path" ,
966
+ cypress_config_filename : "cypress.json" ,
967
+ spec_timeout : 10 ,
968
+ cypressTestSuiteType : Constants . CYPRESS_V9_AND_OLDER_TYPE
966
969
} ,
967
970
connection_settings : { local : false }
968
971
} ;
972
+ loggerWarningSpy = sinon . stub ( logger , 'warn' ) ;
973
+ } ) ;
974
+
975
+ afterEach ( function ( ) {
976
+ loggerWarningSpy . restore ( ) ;
969
977
} ) ;
978
+
970
979
it ( "validate cypress json is present" , ( ) => {
971
980
//Stub for cypress json validation
972
981
sinon . stub ( fs , 'existsSync' ) . returns ( false ) ;
@@ -1046,6 +1055,19 @@ describe("capabilityHelper.js", () => {
1046
1055
} ) ;
1047
1056
} ) ;
1048
1057
1058
+ it ( "should warn if port is passed in cypress config file" , async ( ) => {
1059
+ //Stub for cypress json validation
1060
+ sinon . stub ( fs , 'existsSync' ) . returns ( true ) ;
1061
+ sinon . stub ( fs , 'readFileSync' ) . returns ( '{ "port": 23455}' ) ;
1062
+
1063
+ await capabilityHelper
1064
+ . validate ( bsConfig , { parallels : 2 } )
1065
+
1066
+ sinon . assert . calledWith ( loggerWarningSpy , `The requested port number 23455 is ignored. The default BrowserStack port will be used for this execution` ) ;
1067
+ fs . existsSync . restore ( ) ;
1068
+ fs . readFileSync . restore ( ) ;
1069
+ } ) ;
1070
+
1049
1071
context ( "cypress config file set to false" , ( ) => {
1050
1072
beforeEach ( function ( ) {
1051
1073
readFileSpy = sinon . stub ( fs , 'readFileSync' ) ;
0 commit comments