From b2bbe9665735fc91f23746502f015b1b1bfc436d Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 12 Feb 2021 22:41:40 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20don=E2=80=99t=20try=20to=20detect=20majo?= =?UTF-8?q?r=20automerge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lookup/__snapshots__/index.spec.ts.snap | 120 ------------------ .../repository/process/lookup/index.spec.ts | 20 --- .../repository/process/lookup/index.ts | 12 +- 3 files changed, 4 insertions(+), 148 deletions(-) diff --git a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap index ef33c27800..4e39cee3d1 100644 --- a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap +++ b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap @@ -881,126 +881,6 @@ Array [ ] `; -exports[`workers/repository/process/lookup .lookupUpdates() returns only one update if automerging 1`] = ` -Array [ - Object { - "fromVersion": "0.4.0", - "isSingleVersion": true, - "newMajor": 1, - "newMinor": 4, - "newValue": "1.4.1", - "releaseTimestamp": "2015-05-17T04:25:07.299Z", - "skippedOverVersions": Array [ - "0.4.1", - "0.4.2", - "0.4.4", - "0.5.0", - "0.5.1", - "0.5.2", - "0.5.3", - "0.6.0", - "0.7.0", - "0.7.1", - "0.7.2", - "0.8.0", - "0.8.1", - "0.8.2", - "0.8.3", - "0.8.4", - "0.8.5", - "0.8.6", - "0.8.7", - "0.8.8", - "0.8.9", - "0.8.10", - "0.8.11", - "0.8.12", - "0.9.0", - "0.9.1", - "0.9.2", - "0.9.3", - "0.9.4", - "0.9.5", - "0.9.6", - "0.9.7", - "1.0.0", - "1.0.1", - "1.1.0", - "1.1.1", - "1.1.2", - "1.2.0", - "1.2.1", - "1.3.0", - "1.4.0", - ], - "toVersion": "1.4.1", - "updateType": "major", - }, -] -`; - -exports[`workers/repository/process/lookup .lookupUpdates() returns only one update if automerging major 1`] = ` -Array [ - Object { - "isPin": true, - "newMajor": 0, - "newValue": "0.4.4", - "updateType": "pin", - }, - Object { - "blockedByPin": true, - "fromVersion": "0.4.4", - "isSingleVersion": true, - "newMajor": 1, - "newMinor": 4, - "newValue": "1.4.1", - "releaseTimestamp": "2015-05-17T04:25:07.299Z", - "skippedOverVersions": Array [ - "0.5.0", - "0.5.1", - "0.5.2", - "0.5.3", - "0.6.0", - "0.7.0", - "0.7.1", - "0.7.2", - "0.8.0", - "0.8.1", - "0.8.2", - "0.8.3", - "0.8.4", - "0.8.5", - "0.8.6", - "0.8.7", - "0.8.8", - "0.8.9", - "0.8.10", - "0.8.11", - "0.8.12", - "0.9.0", - "0.9.1", - "0.9.2", - "0.9.3", - "0.9.4", - "0.9.5", - "0.9.6", - "0.9.7", - "1.0.0", - "1.0.1", - "1.1.0", - "1.1.1", - "1.1.2", - "1.2.0", - "1.2.1", - "1.3.0", - "1.4.0", - ], - "toVersion": "1.4.1", - "updateType": "major", - }, -] -`; - exports[`workers/repository/process/lookup .lookupUpdates() returns patch minor and major 1`] = ` Array [ Object { diff --git a/lib/workers/repository/process/lookup/index.spec.ts b/lib/workers/repository/process/lookup/index.spec.ts index d6655f8625..cf42ad4067 100644 --- a/lib/workers/repository/process/lookup/index.spec.ts +++ b/lib/workers/repository/process/lookup/index.spec.ts @@ -119,26 +119,6 @@ describe('workers/repository/process/lookup', () => { expect(res.updates).toMatchSnapshot(); expect(res.updates).toHaveLength(1); }); - it('returns only one update if automerging', async () => { - config.automerge = true; - config.currentValue = '0.4.0'; - config.rangeStrategy = 'pin'; - config.depName = 'q'; - config.datasource = datasourceNpmId; - nock('https://registry.npmjs.org').get('/q').reply(200, qJson); - const res = await lookup.lookupUpdates(config); - expect(res.updates).toMatchSnapshot(); - expect(res.updates).toHaveLength(1); - }); - it('returns only one update if automerging major', async () => { - config.major = { automerge: true }; - config.currentValue = '^0.4.0'; - config.rangeStrategy = 'pin'; - config.depName = 'q'; - config.datasource = datasourceNpmId; - nock('https://registry.npmjs.org').get('/q').reply(200, qJson); - expect((await lookup.lookupUpdates(config)).updates).toMatchSnapshot(); - }); it('returns both updates if automerging minor', async () => { config.minor = { automerge: true }; config.currentValue = '^0.4.0'; diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index 4f0508ef42..6be3071085 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -115,16 +115,12 @@ function getFromVersion( function getBucket(config: LookupUpdateConfig, update: LookupUpdate): string { const { separateMajorMinor, separateMultipleMajor } = config; const { updateType, newMajor } = update; - if ( - !separateMajorMinor || - config.major.automerge === true || - (config.automerge && config.major.automerge !== false) - ) { - return 'latest'; - } if (separateMultipleMajor && updateType === 'major') { return `major-${newMajor}`; } + if (!separateMajorMinor) { + return 'latest'; + } return updateType; } @@ -333,7 +329,7 @@ export async function lookupUpdates( update.newMajor = version.getMajor(toVersion); update.newMinor = version.getMinor(toVersion); update.updateType = - update.updateType || getType(config, update.fromVersion, toVersion); + update.updateType || getType(config, fromVersion, toVersion); const bucket = getBucket(config, update); if (buckets[bucket]) { -- GitLab