Skip to content

Commit 6dfae1d

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

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
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

tests/legacy-cli/e2e_runner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ process.env.CHROMEDRIVER_BIN = path.resolve(process.env.CHROMEDRIVER_BIN!);
233233
findFreePort(),
234234
findPackageTars(),
235235
]);
236-
setGlobalVariable('package-registry', 'http://localhost:' + httpPort);
237-
setGlobalVariable('package-secure-registry', 'http://localhost:' + httpsPort);
236+
setGlobalVariable('package-registry', 'http://localhost:' + httpPort + '/');
237+
setGlobalVariable('package-secure-registry', 'http://localhost:' + httpsPort + '/');
238238
setGlobalVariable('package-tars', packageTars);
239239

240240
// NPM registries for the lifetime of the test execution

0 commit comments

Comments
 (0)