fix: strip trailing #something from manual repository url

This commit is contained in:
Rhys Arkins 2018-02-08 13:22:39 +01:00
parent 5794e008ce
commit f07a7a33c0
3 changed files with 5 additions and 70 deletions

View file

@ -52,11 +52,15 @@ async function getChangeLogJSON(depName, fromVersion, newVersion) {
if (!res) { if (!res) {
logger.debug('Checking for github source URL manually'); logger.debug('Checking for github source URL manually');
const dep = await npmRegistry.getDependency(depName); const dep = await npmRegistry.getDependency(depName);
// istanbul ignore if
if (dep && dep.repositoryUrl) { if (dep && dep.repositoryUrl) {
logger.info('Found github URL manually'); logger.info('Found github URL manually');
const github = dep.repositoryUrl
.replace('https://github.com/', '')
.replace(/#.*/, '');
res = { res = {
project: { project: {
github: dep.repositoryUrl.replace('https://github.com/', ''), github,
}, },
versions: Object.keys(dep.versions) versions: Object.keys(dep.versions)
.filter(v => semver.satisfies(v, semverString)) .filter(v => semver.satisfies(v, semverString))

View file

@ -1,66 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`workers/pr/changelog getChangeLogJSON finds dep manually 1`] = `
Object {
"hasReleaseNotes": false,
"project": Object {
"github": "renovateapp/renovate",
},
"versions": Array [
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.1.0",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.2.0",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.3.0",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.0",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.1",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.2",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.3",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.4",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "2.4.5",
},
Object {
"changes": Array [],
"releaseNotes": undefined,
"version": "3.0.0",
},
],
}
`;
exports[`workers/pr/changelog getChangeLogJSON sorts JSON 1`] = ` exports[`workers/pr/changelog getChangeLogJSON sorts JSON 1`] = `
Object { Object {
"hasReleaseNotes": false, "hasReleaseNotes": false,

View file

@ -33,14 +33,6 @@ describe('workers/pr/changelog', () => {
await changelogHelper.getChangeLogJSON('renovate', '1.0.0', '2.0.0') await changelogHelper.getChangeLogJSON('renovate', '1.0.0', '2.0.0')
).toMatchObject({ a: 1 }); ).toMatchObject({ a: 1 });
}); });
it('finds dep manually', async () => {
changelog.generate = jest.fn(() => {
throw new Error('Unknown Github Repo');
});
expect(
await changelogHelper.getChangeLogJSON('renovate', '2.0.0', '3.0.0')
).toMatchSnapshot();
});
it('filters unnecessary warns', async () => { it('filters unnecessary warns', async () => {
changelog.generate = jest.fn(() => { changelog.generate = jest.fn(() => {
throw new Error('Unknown Github Repo'); throw new Error('Unknown Github Repo');