@@ -189,41 +189,39 @@ describe('buildCommandString', () => {
189189 expect ( result ) . toBe ( 'npm install --save-dev vitest' ) ;
190190 } ) ;
191191
192- it ( 'should escape arguments containing spaces' , ( ) => {
192+ it ( 'should handle arguments containing spaces' , ( ) => {
193193 const command = 'code' ;
194194 const args = [ 'My Project/index.js' ] ;
195195 const result = buildCommandString ( command , args ) ;
196- expect ( result ) . toBe ( 'code " My Project/index.js" ' ) ;
196+ expect ( result ) . toBe ( 'code My Project/index.js' ) ;
197197 } ) ;
198198
199- it ( 'should escape arguments containing double quotes' , ( ) => {
199+ it ( 'should handle arguments containing double quotes' , ( ) => {
200200 const command = 'echo' ;
201201 const args = [ 'Hello "World"' ] ;
202202 const result = buildCommandString ( command , args ) ;
203- expect ( result ) . toBe ( 'echo " Hello \\ "World\\" "' ) ;
203+ expect ( result ) . toBe ( 'echo Hello "World"' ) ;
204204 } ) ;
205205
206- it ( 'should escape arguments containing single quotes' , ( ) => {
206+ it ( 'should handle arguments containing single quotes' , ( ) => {
207207 const command = 'echo' ;
208208 const args = [ "Hello 'World'" ] ;
209209 const result = buildCommandString ( command , args ) ;
210- expect ( result ) . toBe ( ' echo " Hello \ 'World\'"' ) ;
210+ expect ( result ) . toBe ( " echo Hello 'World'" ) ;
211211 } ) ;
212212
213213 it ( 'should handle mixed arguments with and without special characters' , ( ) => {
214214 const command = 'mycommand' ;
215215 const args = [ 'simple' , 'with spaces' , '--flag' , 'with "quotes"' ] ;
216216 const result = buildCommandString ( command , args ) ;
217- expect ( result ) . toBe (
218- 'mycommand simple "with spaces" --flag "with \\"quotes\\""' ,
219- ) ;
217+ expect ( result ) . toBe ( 'mycommand simple with spaces --flag with "quotes"' ) ;
220218 } ) ;
221219
222220 it ( 'should handle arguments with multiple types of quotes' , ( ) => {
223221 const command = 'test' ;
224222 const args = [ 'arg with "double" and \'single\' quotes' ] ;
225223 const result = buildCommandString ( command , args ) ;
226- expect ( result ) . toBe ( 'test " arg with \\ "double\\ " and \'single\' quotes" ' ) ;
224+ expect ( result ) . toBe ( 'test arg with "double" and \'single\' quotes' ) ;
227225 } ) ;
228226
229227 it ( 'should handle objects with undefined' , ( ) => {
@@ -243,6 +241,6 @@ describe('buildCommandString', () => {
243241 const command = 'test' ;
244242 const args = [ ' ' ] ;
245243 const result = buildCommandString ( command , args ) ;
246- expect ( result ) . toBe ( 'test " " ' ) ;
244+ expect ( result ) . toBe ( 'test ' ) ;
247245 } ) ;
248246} ) ;
0 commit comments