@@ -22,8 +22,8 @@ describe('registry validation', () => {
2222
2323 it ( 'should not match safe URL characters' , ( ) => {
2424 expect ( SHELL_METACHARACTERS . test ( 'https://registry.example.com' ) ) . toBe ( false ) ;
25- expect ( SHELL_METACHARACTERS . test ( 'http://registry.example.com/path ' ) ) . toBe ( false ) ;
26- expect ( SHELL_METACHARACTERS . test ( 'https://registry.example.com:8080 ' ) ) . toBe ( false ) ;
25+ expect ( SHELL_METACHARACTERS . test ( 'http://registry.example.com:8080 ' ) ) . toBe ( false ) ;
26+ expect ( SHELL_METACHARACTERS . test ( 'https://registry.example.com/path ' ) ) . toBe ( false ) ;
2727 } ) ;
2828 } ) ;
2929
@@ -61,28 +61,4 @@ describe('registry validation', () => {
6161 ) ;
6262 } ) ;
6363 } ) ;
64-
65- describe ( 'Windows shell quoting' , ( ) => {
66- it ( 'should wrap args in double quotes' , ( ) => {
67- const command = 'npm' ;
68- const args = [ '--registry' , 'https://registry.example.com' ] ;
69- const result = `${ command } ${ args
70- . map ( ( a ) => `"${ String ( a ) . replace ( / " / g, '\\"' ) } "` )
71- . join ( ' ' ) } `;
72- expect ( result ) . toBe (
73- 'npm "--registry" "https://registry.example.com"' ,
74- ) ;
75- } ) ;
76-
77- it ( 'should escape inner double quotes' , ( ) => {
78- const command = 'npm' ;
79- const args = [ '--registry' , 'https://example.com?key="value"' ] ;
80- const result = `${ command } ${ args
81- . map ( ( a ) => `"${ String ( a ) . replace ( / " / g, '\\"' ) } "` )
82- . join ( ' ' ) } `;
83- expect ( result ) . toBe (
84- 'npm "--registry" "https://example.com?key=\\"value\\""' ,
85- ) ;
86- } ) ;
87- } ) ;
8864} ) ;
0 commit comments