Skip to content

Commit 639bf98

Browse files
committed
test: create yarnrc for registry E2E add tests
1 parent e6b2020 commit 639bf98

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function createNpmRegistry(
4949
// Token was generated using `echo -n 'testing:s3cret' | openssl base64`.
5050
const VALID_TOKEN = `dGVzdGluZzpzM2NyZXQ=`;
5151

52-
export function createNpmConfigForAuthentication(
52+
export async function createNpmConfigForAuthentication(
5353
/**
5454
* When true, the authentication token will be scoped to the registry URL.
5555
* @example
@@ -70,17 +70,30 @@ export function createNpmConfigForAuthentication(
7070
const token = invalidToken ? `invalid=` : VALID_TOKEN;
7171
const registry = (getGlobalVariable('package-secure-registry') as string).replace(/^\w+:/, '');
7272

73-
return writeFile(
73+
await writeFile(
7474
'.npmrc',
7575
scopedAuthentication
7676
? `
77-
${registry}:_auth="${token}"
78-
registry=http:${registry}
79-
`
77+
${registry}/:_auth="${token}"
78+
registry=http:${registry}
79+
`
8080
: `
81-
_auth="${token}"
82-
registry=http:${registry}
83-
`,
81+
_auth="${token}"
82+
registry=http:${registry}
83+
`,
84+
);
85+
86+
await writeFile(
87+
'.yarnrc',
88+
scopedAuthentication
89+
? `
90+
${registry}:_auth "${token}"
91+
registry http:${registry}
92+
`
93+
: `
94+
_auth "${token}"
95+
registry http:${registry}
96+
`,
8497
);
8598
}
8699

0 commit comments

Comments
 (0)