@@ -1085,7 +1085,6 @@ describe("capabilityHelper.js", () => {
1085
1085
} ) ;
1086
1086
1087
1087
it ( "does not exist" , ( ) => {
1088
- // sinon.stub(fs, 'existsSync').returns(false);
1089
1088
bsConfig . run_settings . cypressConfigFilePath = 'false' ;
1090
1089
bsConfig . run_settings . cypress_config_filename = 'false' ;
1091
1090
bsConfig . run_settings . home_directory = '/some/random' ;
@@ -1107,7 +1106,6 @@ describe("capabilityHelper.js", () => {
1107
1106
} ) ;
1108
1107
1109
1108
it ( "is not a directory" , ( ) => {
1110
- // sinon.stub(fs, 'existsSync').returns(false);
1111
1109
bsConfig . run_settings . cypressConfigFilePath = 'false' ;
1112
1110
bsConfig . run_settings . cypress_config_filename = 'false' ;
1113
1111
bsConfig . run_settings . home_directory = '/some/random/file.ext' ;
@@ -1131,7 +1129,6 @@ describe("capabilityHelper.js", () => {
1131
1129
} ) ;
1132
1130
1133
1131
it ( "does not contain cypressConfigFilePath" , ( ) => {
1134
- // sinon.stub(fs, 'existsSync').returns(false);
1135
1132
bsConfig . run_settings . cypressConfigFilePath = 'false' ;
1136
1133
bsConfig . run_settings . cypress_config_filename = 'false' ;
1137
1134
bsConfig . run_settings . home_directory = '/some/random' ;
@@ -1153,6 +1150,29 @@ describe("capabilityHelper.js", () => {
1153
1150
fs . statSync . restore ( ) ;
1154
1151
} ) ;
1155
1152
} ) ;
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
+ } ) ;
1156
1176
} ) ;
1157
1177
} ) ;
1158
1178
} ) ;
0 commit comments