fix(poetry): Fix existing range unions (#19785)

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2023-01-11 17:21:56 +01:00 committed by GitHub
parent de289bb409
commit 1991b7fcb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -226,6 +226,7 @@ describe('modules/versioning/poetry/index', () => {
${'~1.2'} | ${'replace'} | ${'1.2.3'} | ${'2.0.0'} | ${'~2.0'}
${'~1'} | ${'replace'} | ${'1.2.3'} | ${'2.0.0'} | ${'~2'}
${'^2.2'} | ${'widen'} | ${'2.2.0'} | ${'3.0.0'} | ${'^2.2 || ^3.0.0'}
${'^2.2 || ^3.0.0'} | ${'widen'} | ${'3.0.0'} | ${'4.0.0'} | ${'^2.2 || ^3.0.0 || ^4.0.0'}
${'^3.5'} | ${'pin'} | ${'3.5'} | ${'3.5'} | ${'3.5'}
`(
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',

View file

@ -144,5 +144,5 @@ export function npm2poetry(range: string): string {
res.splice(i, 2, newValue);
}
}
return res.join(', ').replace(/\s*,?\s*\|\|\s*,?\s*/, ' || ');
return res.join(', ').replace(/\s*,?\s*\|\|\s*,?\s*/g, ' || ');
}