Skip to content

Commit

Permalink
wip: always use env vars instead of npmrc
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed May 20, 2022
1 parent d29004e commit f41341f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/legacy-cli/e2e/utils/packages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getGlobalVariable } from './env';
import { ProcessOutput, npm, silentNpm, silentYarn } from './process';
import { ProcessOutput, silentNpm, silentYarn } from './process';

export function getActivePackageManager(): 'npm' | 'yarn' {
const value = getGlobalVariable('package-manager');
Expand Down Expand Up @@ -49,17 +49,11 @@ export async function setRegistry(useTestRegistry: boolean): Promise<void> {
? getGlobalVariable('package-registry')
: '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) {
// 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;

// 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

0 comments on commit f41341f

Please sign in to comment.