diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-03-12 07:39:36 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-03-12 19:49:27 -0400 |
commit | 0acdd8402614ce39a95a798b7e2898972332c4c7 (patch) | |
tree | 4b18d6d65e60f3cabae64eea1ad255ad79285d05 | |
parent | cb5f358ee7461f191db8c88e0af26023558f5232 (diff) | |
download | android-node-v8-0acdd8402614ce39a95a798b7e2898972332c4c7.tar.gz android-node-v8-0acdd8402614ce39a95a798b7e2898972332c4c7.tar.bz2 android-node-v8-0acdd8402614ce39a95a798b7e2898972332c4c7.zip |
tools: fix test-npm-package
Migrate the script to the new common tmpDir API.
PR-URL: https://github.com/nodejs/node/pull/19293
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
-rwxr-xr-x | tools/test-npm-package.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/test-npm-package.js b/tools/test-npm-package.js index 00e9a81928..0cf9700ef9 100755 --- a/tools/test-npm-package.js +++ b/tools/test-npm-package.js @@ -22,6 +22,7 @@ const { createWriteStream, mkdirSync, rmdirSync } = require('fs'); const path = require('path'); const common = require('../test/common'); +const tmpDir = require('../test/common/tmpdir'); const projectDir = path.resolve(__dirname, '..'); const npmBin = path.join(projectDir, 'deps', 'npm', 'bin', 'npm-cli.js'); @@ -39,15 +40,14 @@ function spawnCopyDeepSync(source, destination) { function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) { // Make sure we don't conflict with concurrent test runs const srcHash = createHash('md5').update(srcDir).digest('hex'); - common.tmpDir = `${common.tmpDir}.npm.${srcHash}`; - common.refreshTmpDir(); + tmpDir.path = `${tmpDir.path}.npm.${srcHash}`; + tmpDir.refresh(); - const tmpDir = common.tmpDir; - const npmCache = path.join(tmpDir, 'npm-cache'); - const npmPrefix = path.join(tmpDir, 'npm-prefix'); - const npmTmp = path.join(tmpDir, 'npm-tmp'); - const npmUserconfig = path.join(tmpDir, 'npm-userconfig'); - const pkgDir = path.join(tmpDir, 'pkg'); + const npmCache = path.join(tmpDir.path, 'npm-cache'); + const npmPrefix = path.join(tmpDir.path, 'npm-prefix'); + const npmTmp = path.join(tmpDir.path, 'npm-tmp'); + const npmUserconfig = path.join(tmpDir.path, 'npm-userconfig'); + const pkgDir = path.join(tmpDir.path, 'pkg'); spawnCopyDeepSync(srcDir, pkgDir); @@ -63,10 +63,10 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) { }; if (common.isWindows) { - npmOptions.env.home = tmpDir; + npmOptions.env.home = tmpDir.path; npmOptions.env.Path = `${nodePath};${process.env.Path}`; } else { - npmOptions.env.HOME = tmpDir; + npmOptions.env.HOME = tmpDir.path; npmOptions.env.PATH = `${nodePath}:${process.env.PATH}`; } @@ -102,8 +102,8 @@ function runNPMPackageTests({ srcDir, install, rebuild, testArgs, logfile }) { } testChild.on('exit', () => { - common.refreshTmpDir(); - rmdirSync(tmpDir); + tmpDir.refresh(); + rmdirSync(tmpDir.path); }); } |