Skip to content
Snippets Groups Projects
Commit d6c5aa66 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix: info not warn for scoped package 404s (#701)

parent 68033a70
No related branches found
No related tags found
No related merge requests found
......@@ -43,8 +43,12 @@ async function renovatePackage(config) {
type: 'error',
message: 'Failed to look up dependency',
};
logger.warn(result.message);
results = [result];
if (config.depName[0] === '@') {
logger.info(result.message);
} else {
logger.warn(result.message);
}
}
logger.debug({ results }, `${config.depName} lookup results`);
// Flatten the result on top of config, add repositoryUrl
......
......@@ -217,6 +217,158 @@ This {{#if isGitHub}}PR{{else}}MR{{/if}} has been generated by [Renovate Bot](ht
]
`;
exports[`lib/workers/package/index renovatePackage(config) returns error if no npm scoped dep found 1`] = `
Array [
Object {
"assignees": Array [],
"automerge": "none",
"automergeType": "pr",
"branchName": "{{branchPrefix}}{{depName}}-{{newVersionMajor}}.x",
"branchPrefix": "renovate/",
"commitMessage": "Update dependency {{depName}} to v{{newVersion}}",
"currentVersion": "1.0.0",
"depName": "@foo/something",
"description": Array [],
"group": Object {
"branchName": "{{branchPrefix}}{{groupSlug}}",
"commitMessage": "Renovate {{groupName}} packages",
"prBody": "This {{#if isGitHub}}Pull{{else}}Merge{{/if}} Request renovates the package group \\"{{groupName}}\\".
{{#if schedule}}
**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
{{/if}}
{{#each upgrades as |upgrade|}}
- {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}\`{{depName}}\`{{/if}}: from \`{{upgrade.currentVersion}}\` to \`{{upgrade.newVersion}}\`
{{/each}}
{{#unless isPin}}
### Commits
{{#each upgrades as |upgrade|}}
{{#if upgrade.releases.length}}
<details>
<summary>{{upgrade.githubName}}</summary>
{{#each upgrade.releases as |release|}}
#### {{release.version}}
{{#each release.commits as |commit|}}
- [\`{{commit.shortSha}}\`]({{commit.url}}){{commit.message}}
{{/each}}
{{/each}}
</details>
{{/if}}
{{/each}}
{{/unless}}
<br />
{{#if hasErrors}}
---
### Errors
Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.
{{#each errors as |error|}}
- \`{{error.depName}}\`: {{error.message}}
{{/each}}
{{/if}}
{{#if hasWarnings}}
---
### Warnings
Please make sure the following warnings are safe to ignore:
{{#each warnings as |warning|}}
- \`{{warning.depName}}\`: {{warning.message}}
{{/each}}
{{/if}}
---
This {{#if isGitHub}}PR{{else}}MR{{/if}} has been generated by [Renovate Bot](https://renovateapp.com).",
"prTitle": "Renovate {{groupName}} packages",
"recreateClosed": true,
},
"groupName": null,
"groupSlug": null,
"labels": Array [],
"lazyGrouping": true,
"message": "Failed to look up dependency",
"prBody": "This {{#if isGitHub}}Pull{{else}}Merge{{/if}} Request {{#if isRollback}}rolls back{{else}}updates{{/if}} dependency {{#if repositoryUrl}}[{{depName}}]({{repositoryUrl}}){{else}}\`{{depName}}\`{{/if}} from \`v{{currentVersion}}\` to \`v{{newVersion}}\`{{#if isRollback}}. This is necessary and important because \`v{{currentVersion}}\` cannot be found in the npm registry - probably because of it being unpublished.{{/if}}
{{#if releases.length}}
{{#if schedule}}
**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
{{/if}}
### Commits
<details>
<summary>{{githubName}}</summary>
{{#each releases as |release|}}
#### {{release.version}}
{{#each release.commits as |commit|}}
- [\`{{commit.shortSha}}\`]({{commit.url}}) {{commit.message}}
{{/each}}
{{/each}}
</details>
{{/if}}
{{#if hasErrors}}
---
### Errors
Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.
{{#each errors as |error|}}
- \`{{error.depName}}\`: {{error.message}}
{{/each}}
{{/if}}
{{#if hasWarnings}}
---
### Warnings
Please make sure the following warnings are safe to ignore:
{{#each warnings as |warning|}}
- \`{{warning.depName}}\`: {{warning.message}}
{{/each}}
{{/if}}
---
This {{#if isGitHub}}PR{{else}}MR{{/if}} has been generated by [Renovate Bot](https://renovateapp.com).",
"prCreation": "immediate",
"prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
"rebaseStalePrs": false,
"recreateClosed": false,
"repoIsOnboarded": true,
"repositoryUrl": null,
"requiredStatusChecks": Array [],
"reviewers": Array [],
"schedule": "some schedule",
"semanticCommits": null,
"semanticPrefix": "chore(deps):",
"timezone": null,
"type": "error",
"unpublishSafe": false,
},
]
`;
exports[`lib/workers/package/index renovatePackage(config) returns warning if using invalid version 1`] = `
Array [
Object {
......
......@@ -35,6 +35,15 @@ describe('lib/workers/package/index', () => {
expect(res[0].type).toEqual('error');
expect(npmApi.getDependency.mock.calls.length).toBe(1);
});
it('returns error if no npm scoped dep found', async () => {
config.depName = '@foo/something';
config.repoIsOnboarded = true;
config.schedule = 'some schedule';
const res = await pkgWorker.renovatePackage(config);
expect(res).toMatchSnapshot();
expect(res).toHaveLength(1);
expect(res[0].type).toEqual('error');
});
it('returns warning if warning found', async () => {
npmApi.getDependency.mockReturnValueOnce({});
versions.determineUpgrades = jest.fn(() => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment