mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-09 21:46:26 +00:00
Merge 97dbc95cb8
into 766d0c37cf
This commit is contained in:
commit
2c9d3660f8
2 changed files with 29 additions and 0 deletions
|
@ -4947,6 +4947,29 @@ describe('workers/repository/process/lookup/index', () => {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('handles replacements - from datasource', async () => {
|
||||||
|
config.currentValue = '2.0.0';
|
||||||
|
config.packageName = 'org.example:foo';
|
||||||
|
config.datasource = MavenDatasource.id;
|
||||||
|
getMavenReleases.mockResolvedValueOnce({
|
||||||
|
releases: [{ version: '2.0.0' }],
|
||||||
|
replacementName: 'foo:bar',
|
||||||
|
replacementVersion: '2.0.0',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { updates } = await Result.wrap(
|
||||||
|
lookup.lookupUpdates(config),
|
||||||
|
).unwrapOrThrow();
|
||||||
|
|
||||||
|
expect(updates).toEqual([
|
||||||
|
{
|
||||||
|
updateType: 'replacement',
|
||||||
|
newName: 'foo:bar',
|
||||||
|
newValue: '2.0.0',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('rollback for invalid version to last stable version', async () => {
|
it('rollback for invalid version to last stable version', async () => {
|
||||||
config.currentValue = '2.5.17';
|
config.currentValue = '2.5.17';
|
||||||
config.packageName = 'vue';
|
config.packageName = 'vue';
|
||||||
|
|
|
@ -571,6 +571,12 @@ export async function lookupUpdates(
|
||||||
|
|
||||||
if (isReplacementRulesConfigured(config)) {
|
if (isReplacementRulesConfigured(config)) {
|
||||||
addReplacementUpdateIfValid(res.updates, config);
|
addReplacementUpdateIfValid(res.updates, config);
|
||||||
|
} else if (dependency?.replacementName && dependency.replacementVersion) {
|
||||||
|
res.updates.push({
|
||||||
|
updateType: 'replacement',
|
||||||
|
newName: dependency.replacementName,
|
||||||
|
newValue: dependency.replacementVersion,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record if the dep is fixed to a version
|
// Record if the dep is fixed to a version
|
||||||
|
|
Loading…
Reference in a new issue