mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-18 04:59:12 -04:00
Add setting for always-auth (#48)
* Add setting for always-auth - https://docs.npmjs.com/misc/config#always-auth - Allow private repos for stuff like artifactory to work * Fix tests for always-auth
This commit is contained in:
parent
57adacb752
commit
7a3ce83626
7 changed files with 45 additions and 18 deletions
|
@ -33,13 +33,13 @@ describe('installer tests', () => {
|
|||
});
|
||||
|
||||
it('Sets up npmrc for npmjs', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org/');
|
||||
await auth.configAuthentication('https://registry.npmjs.org/', 'false');
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Appends trailing slash to registry', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org');
|
||||
await auth.configAuthentication('https://registry.npmjs.org', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
|
@ -47,16 +47,22 @@ describe('installer tests', () => {
|
|||
|
||||
it('Configures scoped npm registries', async () => {
|
||||
process.env['INPUT_SCOPE'] = 'myScope';
|
||||
await auth.configAuthentication('https://registry.npmjs.org');
|
||||
await auth.configAuthentication('https://registry.npmjs.org', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Automatically configures GPR scope', async () => {
|
||||
await auth.configAuthentication('npm.pkg.github.com');
|
||||
await auth.configAuthentication('npm.pkg.github.com', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Sets up npmrc for always-auth true', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org/', 'true');
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue