Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hex): support update-lockfile strategy #27915

Merged
38 changes: 20 additions & 18 deletions lib/modules/versioning/hex/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,26 @@ describe('modules/versioning/hex/index', () => {
);

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'== 1.2.3'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'== 3.6.1'} | ${'bump'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'== 3.6.1'} | ${'replace'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'~> 1.2'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'1.3.1'} | ${'~> 1.3'}
${'~> 1.2.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.0'}
${'~> 1.2.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2.0'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 and <= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 or <= 2.0.0'}
${'>= 1.0.0 or <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 0.4'} | ${'replace'} | ${'0.4.2'} | ${'0.6.0'} | ${'~> 0.6'}
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'== 1.2.3'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'== 3.6.1'} | ${'bump'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'== 3.6.1'} | ${'replace'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'~> 1.2'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'1.3.1'} | ${'~> 1.3'}
${'~> 1.1'} | ${'update-lockfile'} | ${'1.2.0'} | ${'1.3.0'} | ${'~> 1.1'}
${'~> 1.1'} | ${'update-lockfile'} | ${'1.2.0'} | ${'2.0.0'} | ${'~> 2.0'}
${'~> 1.2.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.0'}
${'~> 1.2.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2.0'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 and <= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 or <= 2.0.0'}
${'>= 1.0.0 or <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 0.4'} | ${'replace'} | ${'0.4.2'} | ${'0.6.0'} | ${'~> 0.6'}
`(
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/versioning/hex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const supportedRangeStrategies: RangeStrategy[] = [
'widen',
'pin',
'replace',
'update-lockfile',
];

function hex2npm(input: string): string {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/pretty-time.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('util/pretty-time', () => {
});

describe('satisfiesDateRange()', () => {
const t0 = DateTime.fromISO('2023-07-07T12:00:00');
const t0 = DateTime.fromISO('2023-07-07T12:00:00Z');
pdm-jd marked this conversation as resolved.
Show resolved Hide resolved

beforeAll(() => {
jest.useFakeTimers();
Expand Down