@@ -22,6 +22,7 @@ const { createWriteStream, mkdirSync, rmdirSync } = require('fs');
2222const  path  =  require ( 'path' ) ; 
2323
2424const  common  =  require ( '../test/common' ) ; 
25+ const  tmpDir  =  require ( '../test/common/tmpdir' ) ; 
2526
2627const  projectDir  =  path . resolve ( __dirname ,  '..' ) ; 
2728const  npmBin  =  path . join ( projectDir ,  'deps' ,  'npm' ,  'bin' ,  'npm-cli.js' ) ; 
@@ -39,15 +40,14 @@ function spawnCopyDeepSync(source, destination) {
3940function  runNPMPackageTests ( {  srcDir,  install,  rebuild,  testArgs,  logfile } )  { 
4041  // Make sure we don't conflict with concurrent test runs 
4142  const  srcHash  =  createHash ( 'md5' ) . update ( srcDir ) . digest ( 'hex' ) ; 
42-   common . tmpDir  =  `${ common . tmpDir } ${ srcHash }  ; 
43-   common . refreshTmpDir ( ) ; 
43+   tmpDir . path  =  `${ tmpDir . path } ${ srcHash }  ; 
44+   tmpDir . refresh ( ) ; 
4445
45-   const  tmpDir  =  common . tmpDir ; 
46-   const  npmCache  =  path . join ( tmpDir ,  'npm-cache' ) ; 
47-   const  npmPrefix  =  path . join ( tmpDir ,  'npm-prefix' ) ; 
48-   const  npmTmp  =  path . join ( tmpDir ,  'npm-tmp' ) ; 
49-   const  npmUserconfig  =  path . join ( tmpDir ,  'npm-userconfig' ) ; 
50-   const  pkgDir  =  path . join ( tmpDir ,  'pkg' ) ; 
46+   const  npmCache  =  path . join ( tmpDir . path ,  'npm-cache' ) ; 
47+   const  npmPrefix  =  path . join ( tmpDir . path ,  'npm-prefix' ) ; 
48+   const  npmTmp  =  path . join ( tmpDir . path ,  'npm-tmp' ) ; 
49+   const  npmUserconfig  =  path . join ( tmpDir . path ,  'npm-userconfig' ) ; 
50+   const  pkgDir  =  path . join ( tmpDir . path ,  'pkg' ) ; 
5151
5252  spawnCopyDeepSync ( srcDir ,  pkgDir ) ; 
5353
@@ -63,10 +63,10 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
6363  } ; 
6464
6565  if  ( common . isWindows )  { 
66-     npmOptions . env . home  =  tmpDir ; 
66+     npmOptions . env . home  =  tmpDir . path ; 
6767    npmOptions . env . Path  =  `${ nodePath } ${ process . env . Path }  ; 
6868  }  else  { 
69-     npmOptions . env . HOME  =  tmpDir ; 
69+     npmOptions . env . HOME  =  tmpDir . path ; 
7070    npmOptions . env . PATH  =  `${ nodePath } ${ process . env . PATH }  ; 
7171  } 
7272
@@ -102,8 +102,8 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
102102  } 
103103
104104  testChild . on ( 'exit' ,  ( )  =>  { 
105-     common . refreshTmpDir ( ) ; 
106-     rmdirSync ( tmpDir ) ; 
105+     tmpDir . refresh ( ) ; 
106+     rmdirSync ( tmpDir . path ) ; 
107107  } ) ; 
108108} 
109109
0 commit comments