Skip to content

Commit 68c5c95

Browse files
committed
test(@angular/cli): remove unscoped authentication test cases from registry tests
1 parent da23ee7 commit 68c5c95

3 files changed

Lines changed: 4 additions & 29 deletions

File tree

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
import { expectFileNotToExist, expectFileToExist } from '../../../utils/fs';
2-
import { getActivePackageManager, installWorkspacePackages } from '../../../utils/packages';
2+
import { installWorkspacePackages } from '../../../utils/packages';
33
import { git, ng } from '../../../utils/process';
44
import { createNpmConfigForAuthentication } from '../../../utils/registry';
55
import { expectToFail } from '../../../utils/utils';
66

77
export default async function () {
88
// The environment variable has priority over the .npmrc
99
delete process.env['NPM_CONFIG_REGISTRY'];
10-
const isNpm = getActivePackageManager() === 'npm';
1110

1211
const command = ['add', '@angular/pwa', '--skip-confirmation'];
13-
await expectFileNotToExist('public/manifest.webmanifest');
1412

15-
// Works with unscoped registry authentication details
16-
if (!isNpm) {
17-
// NPM no longer support unscoped.
18-
await createNpmConfigForAuthentication(false);
19-
await ng(...command);
20-
await expectFileToExist('public/manifest.webmanifest');
21-
await git('clean', '-dxf');
22-
}
2313
// Works with scoped registry authentication details
2414
await expectFileNotToExist('public/manifest.webmanifest');
2515

26-
await createNpmConfigForAuthentication(true);
16+
await createNpmConfigForAuthentication();
2717
await ng(...command);
2818
await expectFileToExist('public/manifest.webmanifest');
2919

3020
// Invalid authentication token
31-
if (isNpm) {
32-
// NPM no longer support unscoped.
33-
await createNpmConfigForAuthentication(false, true);
34-
await expectToFail(() => ng(...command));
35-
}
36-
3721
await createNpmConfigForAuthentication(true, true);
3822
await expectToFail(() => ng(...command));
3923

tests/legacy-cli/e2e/tests/update/update-secure-registry.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@ export default async function () {
1616
}
1717

1818
// Valid authentication token
19-
await createNpmConfigForAuthentication(false);
20-
const { stdout: stdout1 } = await ng('update', ...extraArgs);
21-
if (!stdout1.includes(worksMessage)) {
22-
throw new Error(`Expected stdout to contain "${worksMessage}"`);
23-
}
24-
25-
await createNpmConfigForAuthentication(true);
19+
await createNpmConfigForAuthentication();
2620
const { stdout: stdout2 } = await ng('update', ...extraArgs);
2721
if (!stdout2.includes(worksMessage)) {
2822
throw new Error(`Expected stdout to contain "${worksMessage}"`);
2923
}
3024

3125
// Invalid authentication token
32-
await createNpmConfigForAuthentication(false, true);
33-
await expectToFail(() => ng('update', ...extraArgs));
34-
3526
await createNpmConfigForAuthentication(true, true);
3627
await expectToFail(() => ng('update', ...extraArgs));
3728

tests/legacy-cli/e2e/utils/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function createNpmConfigForAuthentication(
5858
* _auth="dGVzdGluZzpzM2NyZXQ="`
5959
* ```
6060
*/
61-
scopedAuthentication: boolean,
61+
scopedAuthentication = true,
6262
/** When true, an incorrect token is used. Use this to validate authentication failures. */
6363
invalidToken = false,
6464
): Promise<void> {

0 commit comments

Comments
 (0)