File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed 
packages/tests-unit/tests/utils Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,20 @@ describe("getCrossPlatformPathRegex", () => {
2121      String . raw `\^\(\[123\]\+\|\[123\]\{1,3\}\)\*\\\?\$` , 
2222    ) ; 
2323  } ) ; 
24+ 
25+   it ( "should return cross-platform paths with escaped special characters" ,  ( )  =>  { 
26+     [ 
27+       [ "core/resolve.js" ,  String . raw `core(?:\/|\\)resolve\.js` ] , 
28+       [ "./middleware.mjs" ,  String . raw `\.(?:\/|\\)middleware\.mjs` ] , 
29+     ] . forEach ( ( [ input ,  output ] )  => 
30+       expect ( getCrossPlatformPathRegex ( input ) . source ) . toEqual ( output ) , 
31+     ) ; 
32+   } ) ; 
33+ 
34+   it ( "should return cross-platform paths without escaping special characters" ,  ( )  =>  { 
35+     const  regex  =  getCrossPlatformPathRegex ( "\\./middleware\\.(mjs|cjs)" ,  { 
36+       escape : false , 
37+     } ) ; 
38+     expect ( regex . source ) . toEqual ( String . raw `\.(?:\/|\\)middleware\.(mjs|cjs)` ) ; 
39+   } ) ; 
2440} ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments