Skip to content

Commit 9cdfc96

Browse files
committed
test: update ng-add version specifier test to bypass npm peer dependency issues
NPM's peer dependency resolution has known inconsistencies, which can cause issues when testing `ng-add`. (cherry picked from commit 005f511)
1 parent bb18bc7 commit 9cdfc96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { appendFile } from 'node:fs/promises';
2-
import { expectFileToMatch, rimraf } from '../../../utils/fs';
2+
import { expectFileToMatch } from '../../../utils/fs';
33
import { getActivePackageManager, uninstallPackage } from '../../../utils/packages';
44
import { ng } from '../../../utils/process';
55
import { isPrereleaseCli } from '../../../utils/project';
66

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

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

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

0 commit comments

Comments
 (0)