@@ -22,6 +22,7 @@ const { createWriteStream, mkdirSync, rmdirSync } = require('fs');
22
22
const path = require ( 'path' ) ;
23
23
24
24
const common = require ( '../test/common' ) ;
25
+ const tmpDir = require ( '../test/common/tmpdir' ) ;
25
26
26
27
const projectDir = path . resolve ( __dirname , '..' ) ;
27
28
const npmBin = path . join ( projectDir , 'deps' , 'npm' , 'bin' , 'npm-cli.js' ) ;
@@ -39,15 +40,14 @@ function spawnCopyDeepSync(source, destination) {
39
40
function runNPMPackageTests ( { srcDir, install, rebuild, testArgs, logfile } ) {
40
41
// Make sure we don't conflict with concurrent test runs
41
42
const srcHash = createHash ( 'md5' ) . update ( srcDir ) . digest ( 'hex' ) ;
42
- common . tmpDir = `${ common . tmpDir } .npm.${ srcHash } ` ;
43
- common . refreshTmpDir ( ) ;
43
+ tmpDir . path = `${ tmpDir . path } .npm.${ srcHash } ` ;
44
+ tmpDir . refresh ( ) ;
44
45
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' ) ;
51
51
52
52
spawnCopyDeepSync ( srcDir , pkgDir ) ;
53
53
@@ -63,10 +63,10 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
63
63
} ;
64
64
65
65
if ( common . isWindows ) {
66
- npmOptions . env . home = tmpDir ;
66
+ npmOptions . env . home = tmpDir . path ;
67
67
npmOptions . env . Path = `${ nodePath } ;${ process . env . Path } ` ;
68
68
} else {
69
- npmOptions . env . HOME = tmpDir ;
69
+ npmOptions . env . HOME = tmpDir . path ;
70
70
npmOptions . env . PATH = `${ nodePath } :${ process . env . PATH } ` ;
71
71
}
72
72
@@ -102,8 +102,8 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) {
102
102
}
103
103
104
104
testChild . on ( 'exit' , ( ) => {
105
- common . refreshTmpDir ( ) ;
106
- rmdirSync ( tmpDir ) ;
105
+ tmpDir . refresh ( ) ;
106
+ rmdirSync ( tmpDir . path ) ;
107
107
} ) ;
108
108
}
109
109
0 commit comments