diff --git a/packages/pnpm/package.json b/packages/pnpm/package.json index c05a455301..d31a960475 100644 --- a/packages/pnpm/package.json +++ b/packages/pnpm/package.json @@ -178,7 +178,7 @@ "lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts", "registry-mock": "registry-mock", "test:tap": "ts-node test --type-check", - "pretest:e2e": "rimraf ../../../.tmp/ && rimraf node_modules/.bin/pnpm && registry-mock prepare", + "pretest:e2e": "rimraf node_modules/.bin/pnpm && registry-mock prepare", "test:e2e": "cross-env PNPM_REGISTRY_MOCK_PORT=7772 run-p -r registry-mock test:tap", "test": "npm run lint && npm run tsc && npm run test:e2e", "tsc": "rimraf lib && tsc", diff --git a/packages/supi/package.json b/packages/supi/package.json index 0f87a07c2e..3bc81b45e7 100644 --- a/packages/supi/package.json +++ b/packages/supi/package.json @@ -156,7 +156,7 @@ "registry-mock": "registry-mock", "test:tap": "ts-node test", "test:e2e": "run-p -r registry-mock test:tap", - "pretest": "rimraf ../../../.tmp/ && registry-mock prepare", + "pretest": "registry-mock prepare", "test-with-preview": "pnpm run lint && preview && pnpm run test:e2e", "test": "pnpm run lint && pnpm run tsc && pnpm run test:e2e", "tsc": "rimraf lib && tsc", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc4d68442a..5ca56b129f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1936,6 +1936,7 @@ importers: '@types/mkdirp': 0.5.2 make-dir: 3.0.0 tape: 4.11.0 + tempy: 0.3.0 write-json5-file: 2.1.2 write-pkg: 4.0.0 write-yaml-file: 3.0.1 @@ -1950,6 +1951,7 @@ importers: make-dir: 3.0.0 rimraf: 3.0.0 tape: 4.11.0 + tempy: 0.3.0 tslint-config-standard: 9.0.0 tslint-eslint-rules: 5.4.0 write-json5-file: 2.1.2 @@ -9764,7 +9766,6 @@ packages: resolution: integrity: sha512-G3I7QWUBSNWaekrJcDabydF6dcvy+vZ2PrX04JYq1p914TOLgpN+ryMtheGavs1LYVevTbTmwjQY8aeX8yLsyA== /temp-dir/1.0.0: - dev: true engines: node: '>=4' resolution: @@ -9774,7 +9775,6 @@ packages: temp-dir: 1.0.0 type-fest: 0.3.1 unique-string: 1.0.0 - dev: true engines: node: '>=8' resolution: diff --git a/privatePackages/prepare/package.json b/privatePackages/prepare/package.json index c094cbfb9c..edad6cb781 100644 --- a/privatePackages/prepare/package.json +++ b/privatePackages/prepare/package.json @@ -10,6 +10,7 @@ "@types/mkdirp": "0.5.2", "make-dir": "3.0.0", "tape": "4.11.0", + "tempy": "0.3.0", "write-json5-file": "2.1.2", "write-pkg": "4.0.0", "write-yaml-file": "3.0.1" diff --git a/privatePackages/prepare/src/index.ts b/privatePackages/prepare/src/index.ts index 5c8c17b4d0..928959d53a 100644 --- a/privatePackages/prepare/src/index.ts +++ b/privatePackages/prepare/src/index.ts @@ -3,6 +3,7 @@ import { ImporterManifest } from '@pnpm/types' import makeDir = require('make-dir') import path = require('path') import { Test } from 'tape' +import tempy = require('tempy') import { sync as writeJson5File } from 'write-json5-file' import writePkg = require('write-pkg') import { sync as writeYamlFile } from 'write-yaml-file' @@ -11,8 +12,7 @@ export { Modules, Project } export type ManifestFormat = 'JSON' | 'JSON5' | 'YAML' // the testing folder should be outside of the project to avoid lookup in the project's node_modules -const tmpPath = path.join(__dirname, '..', '..', '..', '..', '.tmp') -makeDir.sync(tmpPath) +const tmpPath = tempy.directory() let dirNumber = 0 @@ -22,7 +22,7 @@ export function tempDir (t: Test) { const tmpDir = path.join(tmpPath, dirname) makeDir.sync(tmpDir) - t.pass(`create testing dir ${dirname}`) + t.pass(`create testing dir ${path.join(tmpDir)}`) process.chdir(tmpDir)