Skip to content

Commit

Permalink
test: update ng-add version specifier test to bypass npm peer depen…
Browse files Browse the repository at this point in the history
…dency issues

NPM's peer dependency resolution has known inconsistencies, which can cause issues when testing `ng-add`.

(cherry picked from commit 005f511)
  • Loading branch information
alan-agius4 committed Mar 5, 2025
1 parent bb18bc7 commit 9cdfc96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { appendFile } from 'node:fs/promises';
import { expectFileToMatch, rimraf } from '../../../utils/fs';
import { expectFileToMatch } from '../../../utils/fs';
import { getActivePackageManager, uninstallPackage } from '../../../utils/packages';
import { ng } from '../../../utils/process';
import { isPrereleaseCli } from '../../../utils/project';

export default async function () {
// forcibly remove in case another test doesn't clean itself up.
await rimraf('node_modules/@angular/localize');
await uninstallPackage('@angular/localize');

// If using npm, enable the force option to allow testing the output behavior of the
// If using npm, enable the legacy-peer-deps option to allow testing the output behavior of the
// `ng add` command itself and not the behavior of npm which may otherwise fail depending
// on the npm version in use and the version specifier supplied in each test.
if (getActivePackageManager() === 'npm') {
await appendFile('.npmrc', '\nforce=true\n');
await appendFile('.npmrc', '\nlegacy-peer-deps=true\n');
}

const tag = (await isPrereleaseCli()) ? '@next' : '';
Expand Down

0 comments on commit 9cdfc96

Please sign in to comment.