0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-11 13:48:55 +00:00
renovatebot_renovate/lib/modules/manager/composer/range.spec.ts
Rhys Arkins 016e647390
feat(config)!: default to rangeStrategy=auto, prefer update-lockfile (#19942)
Changes `rangeStrategy` default value from `'replace'` to `'auto'`. Also changes `auto` behavior so that `update-lockfile` is preferred if the manager
supports the `updateLockedDependency()` function.

Closes #19800

BREAKING CHANGE: Renovate will now default to updating locked dependency versions. To revert to previous behavior, configure rangeStrategy=replace.
2023-03-10 09:25:45 +01:00

60 lines
1.7 KiB
TypeScript

import type { RangeConfig } from '../types';
import { getRangeStrategy } from '.';
describe('modules/manager/composer/range', () => {
it('returns same if not auto', () => {
const config: RangeConfig = { rangeStrategy: 'widen' };
expect(getRangeStrategy(config)).toBe('widen');
});
it('replaces require-dev', () => {
const config: RangeConfig = {
rangeStrategy: 'auto',
depType: 'require-dev',
};
expect(getRangeStrategy(config)).toBe('update-lockfile');
});
it('replaces project require', () => {
const config: RangeConfig = {
rangeStrategy: 'auto',
managerData: { composerJsonType: 'project' },
depType: 'require',
};
expect(getRangeStrategy(config)).toBe('update-lockfile');
});
it('widens complex ranges', () => {
const config: RangeConfig = {
rangeStrategy: 'auto',
depType: 'require',
currentValue: '^1.6.0 || ^2.0.0',
};
expect(getRangeStrategy(config)).toBe('widen');
});
it('widens complex bump', () => {
const config: RangeConfig = {
rangeStrategy: 'bump',
depType: 'require',
currentValue: '^1.6.0 || ^2.0.0',
};
expect(getRangeStrategy(config)).toBe('widen');
});
it('defaults to update-lockfile', () => {
const config: RangeConfig = { rangeStrategy: 'auto', depType: 'require' };
expect(getRangeStrategy(config)).toBe('update-lockfile');
});
it('defaults to widen for TYPO3 extensions', () => {
const config: RangeConfig = {
managerData: {
composerJsonType: 'typo3-cms-extension',
},
rangeStrategy: 'auto',
depType: 'require',
};
expect(getRangeStrategy(config)).toBe('widen');
});
});