Skip to content

Commit 8314369

Browse files
committed
test: always use package manager force option in version add command E2E
The goal of the `commands/add/version-specifier` test is to check the behavior of the `ng add` command itself and not that of the package manager. To do so requires adding a package using a variety of different version specifiers. Some of which a package manager may consider incompatible with the hosting project. However, this is not relevant to the selection logic of the `ng add` command which should select the version as designed. To verify it does so within the Angular CLI, the installed version needs to be checked. As a result the package manager must install the package.
1 parent e0e011f commit 8314369

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ export default async function () {
88
// forcibly remove in case another test doesn't clean itself up.
99
await rimraf('node_modules/@angular/localize');
1010

11-
// If using npm, enable the force option to allow testing the output behavior of the
12-
// `ng add` command itself and not the behavior of npm which may otherwise fail depending
13-
// on the npm version in use and the version specifier supplied in each test.
14-
if (getActivePackageManager() === 'npm') {
15-
appendFile('.npmrc', '\nforce=true\n');
16-
}
11+
// Enable the force option to allow testing the output behavior of the
12+
// `ng add` command itself and not the behavior of the package manager which may otherwise fail depending
13+
// on the package manager version in use and the version specifier supplied in each test.
14+
appendFile('.npmrc', '\nforce=true\n');
15+
appendFile('.yarnrc', '\n--ignore-engines true\n');
1716

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

0 commit comments

Comments
 (0)