Skip to content

Commit 3ccfd7f

Browse files
committed
test(@angular/cli): ensure yarn uses local registry in npm 7 E2E test
(cherry picked from commit 8c2226e)
1 parent 9357266 commit 3ccfd7f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/legacy-cli/e2e/tests/misc/npm-7.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rimraf } from '../../utils/fs';
1+
import { rimraf, writeFile } from '../../utils/fs';
22
import { getActivePackageManager } from '../../utils/packages';
33
import { ng, npm } from '../../utils/process';
44
import { expectToFail } from '../../utils/utils';
@@ -60,6 +60,8 @@ export default async function() {
6060
}
6161

6262
// Ensure `ng new --package-manager=yarn` executes successfully
63+
// Need an additional npmrc file since yarn does not use the NPM registry environment variable
64+
await writeFile('.npmrc', 'registry=http://localhost:4873')
6365
const { stderr: stderrNewYarn } = await ng('new', 'npm-seven-yarn', '--package-manager=yarn');
6466
if (stderrNewYarn.includes(errorText)) {
6567
throw new Error('ng new --package-manager=yarn expected to not show npm version error.');
@@ -68,6 +70,7 @@ export default async function() {
6870
// Cleanup extra test projects
6971
await rimraf('npm-seven-skip');
7072
await rimraf('npm-seven-yarn');
73+
await rimraf('.npmrc');
7174

7275
// Change directory back
7376
process.chdir(currentDirectory);

0 commit comments

Comments
 (0)