mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 16:46:25 +00:00
fix(gomod): go.mod directive should not bump by default (#28475)
This commit is contained in:
parent
b652e853f2
commit
2902d17637
2 changed files with 12 additions and 12 deletions
|
@ -2,12 +2,13 @@ import { api as semver } from '.';
|
||||||
|
|
||||||
describe('modules/versioning/go-mod-directive/index', () => {
|
describe('modules/versioning/go-mod-directive/index', () => {
|
||||||
it.each`
|
it.each`
|
||||||
version | range | expected
|
version | range | expected
|
||||||
${'1.16.0'} | ${'1.16'} | ${true}
|
${'1.16.0'} | ${'1.16'} | ${true}
|
||||||
${'1.16.1'} | ${'1.16'} | ${true}
|
${'1.16.1'} | ${'1.16'} | ${true}
|
||||||
${'1.15.0'} | ${'1.16'} | ${false}
|
${'1.15.0'} | ${'1.16'} | ${false}
|
||||||
${'1.19.1'} | ${'1.16'} | ${true}
|
${'1.19.1'} | ${'1.16'} | ${true}
|
||||||
${'2.0.0'} | ${'1.16'} | ${false}
|
${'2.0.0'} | ${'1.16'} | ${false}
|
||||||
|
${'1.22.2'} | ${'1.21.9'} | ${true}
|
||||||
`(
|
`(
|
||||||
'matches("$version", "$range") === "$expected"',
|
'matches("$version", "$range") === "$expected"',
|
||||||
({ version, range, expected }) => {
|
({ version, range, expected }) => {
|
||||||
|
@ -70,10 +71,12 @@ describe('modules/versioning/go-mod-directive/index', () => {
|
||||||
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.17.0'} | ${'1.17'}
|
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.17.0'} | ${'1.17'}
|
||||||
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
||||||
${'1.16'} | ${'replace'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
${'1.16'} | ${'replace'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
||||||
${'1.16'} | ${'replace'} | ${'1.21.2'} | ${'1.21.2'} | ${'1.21.2'}
|
${'1.16'} | ${'replace'} | ${'1.21.2'} | ${'1.21.2'} | ${'1.16'}
|
||||||
${'1.16'} | ${'widen'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
${'1.16'} | ${'widen'} | ${'1.16.4'} | ${'1.16.4'} | ${'1.16'}
|
||||||
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.21.3'} | ${'1.21.3'}
|
${'1.16'} | ${'bump'} | ${'1.16.4'} | ${'1.21.3'} | ${'1.21.3'}
|
||||||
${'1.21.2'} | ${'bump'} | ${'1.21.2'} | ${'1.21.3'} | ${'1.21.3'}
|
${'1.21.2'} | ${'bump'} | ${'1.21.2'} | ${'1.21.3'} | ${'1.21.3'}
|
||||||
|
${'1.21.2'} | ${'replace'} | ${'1.21.2'} | ${'1.22.2'} | ${'1.21.2'}
|
||||||
|
${'1.21.2'} | ${'replace'} | ${'1.21.2'} | ${'2.0.0'} | ${'2.0.0'}
|
||||||
`(
|
`(
|
||||||
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
|
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
|
||||||
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
|
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
|
||||||
|
|
|
@ -30,11 +30,8 @@ function getNewValue({
|
||||||
}
|
}
|
||||||
return shorten(newVersion);
|
return shorten(newVersion);
|
||||||
}
|
}
|
||||||
if (rangeStrategy === 'replace' && !matches(currentValue, newVersion)) {
|
if (rangeStrategy === 'replace' && !matches(newVersion, currentValue)) {
|
||||||
if (npm.matches(newVersion, '>=1.20.0')) {
|
return newVersion;
|
||||||
return newVersion;
|
|
||||||
}
|
|
||||||
return shorten(newVersion);
|
|
||||||
}
|
}
|
||||||
return currentValue;
|
return currentValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue