File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed 
workspaces/libnpmexec/test Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -11,20 +11,19 @@ const getTempDir = () => fs.realpathSync(os.tmpdir())
1111t . test ( 'concurrent locking' ,  async  ( t )  =>  { 
1212  const  dir  =  fs . mkdtempSync ( path . join ( getTempDir ( ) ,  'test-' ) ) 
1313  const  events  =  [ ] 
14-   const  lockPromises  =  [ 
15-     withLock ( dir ,  async  ( )  =>  { 
16-       events . push ( 'lock1 acquired' ) 
17-       await  setTimeout ( 100 ) 
18-       events . push ( 'lock1 released' ) 
19-     } ) , 
20-     withLock ( dir ,  async  ( )  =>  { 
21-       events . push ( 'lock2 acquired' ) 
22-       await  setTimeout ( 100 ) 
23-       events . push ( 'lock2 released' ) 
24-       return  'lock2' 
25-     } ) , 
26-   ] 
27-   await  Promise . all ( lockPromises ) 
14+   const  lockPromise1  =  withLock ( dir ,  async  ( )  =>  { 
15+     events . push ( 'lock1 acquired' ) 
16+     await  setTimeout ( 100 ) 
17+     events . push ( 'lock1 released' ) 
18+   } ) 
19+   await  setTimeout ( 50 ) 
20+   const  lockPromise2  =  withLock ( dir ,  async  ( )  =>  { 
21+     events . push ( 'lock2 acquired' ) 
22+     await  setTimeout ( 100 ) 
23+     events . push ( 'lock2 released' ) 
24+     return  'lock2' 
25+   } ) 
26+   await  Promise . all ( [ lockPromise1 ,  lockPromise2 ] ) 
2827  t . same ( events ,  [ 
2928    'lock1 acquired' , 
3029    'lock1 released' , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments