Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/legacy-cli/e2e/setup/002-npm-sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default async function () {
// isolated within this e2e test invocation.
process.env.NPM_CONFIG_USERCONFIG = npmrc;
process.env.NPM_CONFIG_PREFIX = npmModulesPrefix;
process.env.NPM_CONFIG_REGISTRY = npmRegistry;

// Snapshot builds may contain versions that are not yet released (e.g., RC phase main branch).
// In this case peer dependency ranges may not resolve causing npm 7+ to fail during tests.
Expand Down
11 changes: 3 additions & 8 deletions tests/legacy-cli/e2e/tests/commands/add/registry-option.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { getGlobalVariable } from '../../../utils/env';
import { expectFileToExist, writeMultipleFiles } from '../../../utils/fs';
import { expectFileToExist } from '../../../utils/fs';
import { ng } from '../../../utils/process';
import { expectToFail } from '../../../utils/utils';

export default async function () {
const testRegistry = getGlobalVariable('package-registry');

// Setup an invalid registry
await writeMultipleFiles({
'.npmrc': 'registry=http://127.0.0.1:9999',
});

// The environment variable has priority over the .npmrc
delete process.env['NPM_CONFIG_REGISTRY'];
// Set an invalid registry
process.env['NPM_CONFIG_REGISTRY'] = 'http://127.0.0.1:9999';

await expectToFail(() => ng('add', '@angular/pwa', '--skip-confirmation'));

Expand Down
9 changes: 2 additions & 7 deletions tests/legacy-cli/e2e/utils/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export async function setRegistry(useTestRegistry: boolean): Promise<void> {
const isCI = getGlobalVariable('ci');

// Ensure local test registry is used when outside a project
if (isCI) {
// Safe to set a user configuration on CI
await npm('config', 'set', 'registry', url);
} else {
// Yarn supports both `NPM_CONFIG_REGISTRY` and `YARN_REGISTRY`.
process.env['NPM_CONFIG_REGISTRY'] = url;
}
// Yarn supports both `NPM_CONFIG_REGISTRY` and `YARN_REGISTRY`.
process.env['NPM_CONFIG_REGISTRY'] = url;
}