Skip to content

Commit fa0ddc5

Browse files
committed
test(@angular/cli): correct unscoped auth E2E test logic
The E2E test for `ng add` with unscoped registry authentication was being incorrectly executed for `pnpm`. The previous logic excluded `npm` and `bun` but erroneously assumed `pnpm` supported this authentication method, which it does not. This commit refines the `supportsUnscopedAuth` condition to be strictly limited to `yarn`. This ensures the unscoped authentication test case is now accurately targeted, only running against the package manager that supports this behavior, thereby improving the overall reliability of the secure registry tests.
1 parent 88102f7 commit fa0ddc5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/legacy-cli/e2e/tests/commands/add/secure-registry.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ export default async function () {
1010
// The environment variable has priority over the .npmrc
1111
delete process.env['NPM_CONFIG_REGISTRY'];
1212
const packageManager = getActivePackageManager();
13-
const supportsUnscopedAuth = packageManager !== 'bun' && packageManager !== 'npm';
13+
const supportsUnscopedAuth = packageManager === 'yarn';
1414
const command = ['add', '@angular/pwa', '--skip-confirmation'];
1515

16-
await expectFileNotToExist('public/manifest.webmanifest');
17-
1816
// Works with unscoped registry authentication details
1917
if (supportsUnscopedAuth) {
2018
// Some package managers such as Bun and NPM do not support unscoped auth.
2119
await createNpmConfigForAuthentication(false);
20+
21+
await expectFileNotToExist('public/manifest.webmanifest');
22+
2223
await ng(...command);
2324
await expectFileToExist('public/manifest.webmanifest');
2425
await git('clean', '-dxf');
@@ -33,7 +34,7 @@ export default async function () {
3334
await git('clean', '-dxf');
3435

3536
// Invalid authentication token
36-
if (!supportsUnscopedAuth) {
37+
if (supportsUnscopedAuth) {
3738
// Some package managers such as Bun and NPM do not support unscoped auth.
3839
await createNpmConfigForAuthentication(false, true);
3940
await expectToFail(() => ng(...command));

0 commit comments

Comments
 (0)