Skip to content

Commit

Permalink
fix: don’t try to detect major automerge
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Feb 12, 2021
1 parent cadace3 commit b2bbe96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 148 deletions.
120 changes: 0 additions & 120 deletions lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 0 additions & 20 deletions lib/workers/repository/process/lookup/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
12 changes: 4 additions & 8 deletions lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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]) {
Expand Down

0 comments on commit b2bbe96

Please sign in to comment.