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
7 changes: 7 additions & 0 deletions tests/legacy-cli/e2e/setup/002-npm-sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export default async function () {
process.env.NPM_CONFIG_USERCONFIG = npmrc;
process.env.NPM_CONFIG_PREFIX = npmModulesPrefix;

// 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.
// To support this case, legacy peer dependency mode is enabled for snapshot builds.
if (getGlobalVariable('argv')['ng-snapshots']) {
process.env['NPM_CONFIG_legacy_peer_deps'] = 'true';
Comment thread
clydin marked this conversation as resolved.
}

// Configure the registry and prefix used within the test sandbox
await writeFile(npmrc, `registry=${npmRegistry}\nprefix=${npmModulesPrefix}`);
await mkdir(npmModulesPrefix);
Expand Down
8 changes: 0 additions & 8 deletions tests/legacy-cli/e2e/utils/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export async function setRegistry(useTestRegistry: boolean): Promise<void> {
: 'https://registry.npmjs.org';

const isCI = getGlobalVariable('ci');
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];

// Ensure local test registry is used when outside a project
if (isCI) {
Expand All @@ -60,11 +59,4 @@ export async function setRegistry(useTestRegistry: boolean): Promise<void> {
// Yarn supports both `NPM_CONFIG_REGISTRY` and `YARN_REGISTRY`.
process.env['NPM_CONFIG_REGISTRY'] = url;
}

// 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.
// To support this case, legacy peer dependency mode is enabled for snapshot builds.
if (isSnapshotBuild) {
process.env['NPM_CONFIG_legacy_peer_deps'] = 'true';
}
}