Skip to content

Commit b2110d8

Browse files
committed
Revert "test: isolate yarn global cache in test sandbox"
This reverts commit ba6b3d7.
1 parent ba6b3d7 commit b2110d8

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

tests/legacy-cli/e2e/setup/002-npm-sandbox.ts

+7-30
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@ import { getGlobalVariable, setGlobalVariable } from '../utils/env';
88
export default async function () {
99
const tempRoot: string = getGlobalVariable('tmp-root');
1010
const npmModulesPrefix = join(tempRoot, 'npm-global');
11-
const yarnModulesPrefix = join(tempRoot, 'yarn-global');
1211
const npmRegistry: string = getGlobalVariable('package-registry');
1312
const npmrc = join(tempRoot, '.npmrc');
14-
const yarnrc = join(tempRoot, '.yarnrc');
15-
const npmCacheFolder = join(tempRoot, 'npm-cache-folder');
16-
const yarnCacheFolder = join(tempRoot, 'yarn-cache-folder');
1713

18-
// Change the npm+yarn userconfig to the sandboxed npmrc to override the default ~
14+
// Configure npm to use the sandboxed npm globals and rc file
15+
// From this point onward all npm transactions use the "global" npm cache
16+
// isolated within this e2e test invocation.
1917
process.env.NPM_CONFIG_USERCONFIG = npmrc;
20-
21-
// The npm+yarn registry URL
22-
process.env.NPM_CONFIG_REGISTRY = npmRegistry;
23-
24-
// Configure npm+yarn to use a sandboxed bin directory
25-
// From this point onward all yarn/npm bin files/symlinks are put into the prefix directories
2618
process.env.NPM_CONFIG_PREFIX = npmModulesPrefix;
27-
process.env.YARN_CONFIG_PREFIX = yarnModulesPrefix;
28-
29-
// Package cache diretories
30-
process.env.NPM_CONFIG_CACHE = npmCacheFolder;
31-
process.env.YARN_CACHE_FOLDER = yarnCacheFolder;
19+
process.env.NPM_CONFIG_REGISTRY = npmRegistry;
3220

3321
// Snapshot builds may contain versions that are not yet released (e.g., RC phase main branch).
3422
// In this case peer dependency ranges may not resolve causing npm 7+ to fail during tests.
@@ -37,22 +25,11 @@ export default async function () {
3725
process.env['NPM_CONFIG_legacy_peer_deps'] = 'true';
3826
}
3927

40-
// Configure the registry and prefix used within the test sandbox via rc files
41-
await writeFile(
42-
npmrc,
43-
`registry=${npmRegistry}\nprefix=${npmModulesPrefix}\ncache=${npmCacheFolder}`,
44-
);
45-
await writeFile(
46-
yarnrc,
47-
`registry ${npmRegistry}\nprefix ${yarnModulesPrefix}\ncache-folder ${yarnCacheFolder}`,
48-
);
28+
// Configure the registry and prefix used within the test sandbox
29+
await writeFile(npmrc, `registry=${npmRegistry}\nprefix=${npmModulesPrefix}`);
4930
await mkdir(npmModulesPrefix);
50-
await mkdir(yarnModulesPrefix);
51-
await mkdir(yarnCacheFolder);
5231

5332
setGlobalVariable('npm-global', npmModulesPrefix);
54-
setGlobalVariable('yarn-global', yarnModulesPrefix);
5533

56-
console.log(` Using "${npmModulesPrefix}" as e2e test global npm bin dir.`);
57-
console.log(` Using "${yarnModulesPrefix}" as e2e test global yarn bin dir.`);
34+
console.log(` Using "${npmModulesPrefix}" as e2e test global npm cache.`);
5835
}

tests/legacy-cli/e2e/utils/process.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface ExecOptions {
1616
cwd?: string;
1717
}
1818

19-
const NPM_CONFIG_RE = /^(npm_config_|yarn_)/i;
19+
const NPM_CONFIG_RE = /^npm_config_/i;
2020

2121
let _processes: child_process.ChildProcess[] = [];
2222

@@ -41,7 +41,6 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<Proce
4141
// Ensure the custom npm and yarn global bin is on the PATH
4242
// https://docs.npmjs.com/cli/v8/configuring-npm/folders#executables
4343
const paths = [
44-
join(getGlobalVariable('yarn-global'), 'bin'),
4544
join(getGlobalVariable('npm-global'), process.platform.startsWith('win') ? '' : 'bin'),
4645
env.PATH || process.env['PATH'],
4746
].join(delimiter);

0 commit comments

Comments
 (0)