@@ -1085,7 +1085,6 @@ describe("capabilityHelper.js", () => {
10851085 } ) ;
10861086
10871087 it ( "does not exist" , ( ) => {
1088- // sinon.stub(fs, 'existsSync').returns(false);
10891088 bsConfig . run_settings . cypressConfigFilePath = 'false' ;
10901089 bsConfig . run_settings . cypress_config_filename = 'false' ;
10911090 bsConfig . run_settings . home_directory = '/some/random' ;
@@ -1107,7 +1106,6 @@ describe("capabilityHelper.js", () => {
11071106 } ) ;
11081107
11091108 it ( "is not a directory" , ( ) => {
1110- // sinon.stub(fs, 'existsSync').returns(false);
11111109 bsConfig . run_settings . cypressConfigFilePath = 'false' ;
11121110 bsConfig . run_settings . cypress_config_filename = 'false' ;
11131111 bsConfig . run_settings . home_directory = '/some/random/file.ext' ;
@@ -1131,7 +1129,6 @@ describe("capabilityHelper.js", () => {
11311129 } ) ;
11321130
11331131 it ( "does not contain cypressConfigFilePath" , ( ) => {
1134- // sinon.stub(fs, 'existsSync').returns(false);
11351132 bsConfig . run_settings . cypressConfigFilePath = 'false' ;
11361133 bsConfig . run_settings . cypress_config_filename = 'false' ;
11371134 bsConfig . run_settings . home_directory = '/some/random' ;
@@ -1153,6 +1150,29 @@ describe("capabilityHelper.js", () => {
11531150 fs . statSync . restore ( ) ;
11541151 } ) ;
11551152 } ) ;
1153+
1154+ it ( "does not contain cypressConfigFilePath with special chars" , ( ) => {
1155+ bsConfig . run_settings . cypressConfigFilePath = 'false' ;
1156+ bsConfig . run_settings . cypress_config_filename = 'false' ;
1157+ bsConfig . run_settings . home_directory = '/$some!@#$%^&*()_+=-[]{};:<>?\'\\\//random' ;
1158+
1159+ sinon . stub ( fs , 'existsSync' ) . returns ( true ) ;
1160+ sinon . stub ( fs , 'statSync' ) . returns ( { isDirectory : ( ) => true } ) ;
1161+
1162+ return capabilityHelper
1163+ . validate ( bsConfig , { } )
1164+ . then ( function ( data ) {
1165+ chai . assert . fail ( "Promise error" ) ;
1166+ } )
1167+ . catch ( ( error ) => {
1168+ chai . assert . equal (
1169+ error ,
1170+ Constants . validationMessages . CYPRESS_CONFIG_FILE_NOT_PART_OF_HOME_DIRECTORY
1171+ ) ;
1172+ fs . existsSync . restore ( ) ;
1173+ fs . statSync . restore ( ) ;
1174+ } ) ;
1175+ } ) ;
11561176 } ) ;
11571177 } ) ;
11581178} ) ;
0 commit comments