Skip to content

Commit c7c8047

Browse files
committed
test(@angular/cli): configure always-auth for Yarn Classic v1 registry authentication
Configure always-auth in the written .npmrc and .yarnrc test profiles within createNpmConfigForAuthentication. By default, Yarn Classic (v1) does not send the Authorization header on GET requests (such as retrieving manifest metadata via yarn info) unless always-auth is enabled. When ng update uses the PackageManager abstraction under Yarn Classic v1, this ensures the necessary authorization headers are sent to secure registry endpoints.
1 parent bf73d2d commit c7c8047

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ export default async function () {
3434
await createNpmConfigForAuthentication(true, true);
3535

3636
const error = await expectToFail(() => exec('yarn', 'ng', 'update', ...extraArgs));
37-
assert.match(error.message, /not allowed to access package/);
37+
assert.match(error.message, /not allowed to access package|status code 403/);
3838
}
3939
}

tests/e2e/utils/registry.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ export async function createNpmConfigForAuthentication(
7575
scopedAuthentication
7676
? `
7777
${registry}/:_auth="${token}"
78+
${registry}/:always-auth=true
79+
always-auth=true
7880
registry=http:${registry}
7981
`
8082
: `
8183
_auth="${token}"
84+
always-auth=true
8285
registry=http:${registry}
8386
`,
8487
);
@@ -88,10 +91,13 @@ registry=http:${registry}
8891
scopedAuthentication
8992
? `
9093
${registry}/:_auth "${token}"
94+
${registry}/:always-auth true
95+
always-auth true
9196
registry http:${registry}
9297
`
9398
: `
9499
_auth "${token}"
100+
always-auth true
95101
registry http:${registry}
96102
`,
97103
);

0 commit comments

Comments
 (0)