mirror of https://github.com/actions/setup-node
adding test for NODE_AUTH_TOKEN overwritten
This commit is contained in:
parent
c6fd00ceb9
commit
8dde5bc004
|
@ -122,5 +122,16 @@ describe('authutil tests', () => {
|
||||||
let rc = readRcFile(rcFile);
|
let rc = readRcFile(rcFile);
|
||||||
expect(rc['registry']).toBe('https://registry.npmjs.org/');
|
expect(rc['registry']).toBe('https://registry.npmjs.org/');
|
||||||
expect(rc['always-auth']).toBe('true');
|
expect(rc['always-auth']).toBe('true');
|
||||||
});
|
})
|
||||||
|
it('It is already set the NODE_AUTH_TOKEN export it ', async ()=> {
|
||||||
|
process.env.NODE_AUTH_TOKEN='foobar';
|
||||||
|
await auth.configAuthentication('npm.pkg.github.com', 'false');
|
||||||
|
expect(fs.statSync(rcFile)).toBeDefined();
|
||||||
|
let rc = readRcFile(rcFile);
|
||||||
|
expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/');
|
||||||
|
expect(rc['always-auth']).toBe('false');
|
||||||
|
dbg(`${JSON.stringify(rc)}`);
|
||||||
|
expect(process.env.NODE_AUTH_TOKEN).toEqual('foobar');
|
||||||
|
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,5 +54,5 @@ function writeRegistryToFile(
|
||||||
fs.writeFileSync(fileLocation, newContents);
|
fs.writeFileSync(fileLocation, newContents);
|
||||||
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
||||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||||
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
|
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue