mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
refactor: info not warn if npm 401 response
This commit is contained in:
parent
976f2ac57e
commit
383302d433
2 changed files with 11 additions and 0 deletions
|
@ -84,6 +84,10 @@ async function getDependency(name) {
|
||||||
logger.trace({ dep }, 'dep');
|
logger.trace({ dep }, 'dep');
|
||||||
return dep;
|
return dep;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err.statusCode === 401) {
|
||||||
|
logger.info({ err, name }, `Dependency lookup unauthorized`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (err.statusCode === 404) {
|
if (err.statusCode === 404) {
|
||||||
logger.info({ err, name }, `Dependency not found`);
|
logger.info({ err, name }, `Dependency not found`);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -45,6 +45,13 @@ describe('api/npm', () => {
|
||||||
const res = await npm.getDependency('foobarhome');
|
const res = await npm.getDependency('foobarhome');
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('should return null if lookup fails 401', async () => {
|
||||||
|
nock('https://registry.npmjs.org')
|
||||||
|
.get('/foobar')
|
||||||
|
.reply(401);
|
||||||
|
const res = await npm.getDependency('foobar');
|
||||||
|
expect(res).toBeNull();
|
||||||
|
});
|
||||||
it('should return null if lookup fails', async () => {
|
it('should return null if lookup fails', async () => {
|
||||||
nock('https://registry.npmjs.org')
|
nock('https://registry.npmjs.org')
|
||||||
.get('/foobar')
|
.get('/foobar')
|
||||||
|
|
Loading…
Reference in a new issue