Skip to content
Snippets Groups Projects
Unverified Commit 2a5c0fbc authored by Gabriel-Ladzaretti's avatar Gabriel-Ladzaretti Committed by GitHub
Browse files

fix(npm/versioning): exception when directly calling getNewValue with...

fix(npm/versioning): exception when directly calling getNewValue with x-range-all '*' with unsupported strategy (#18379)
parent e9153ea2
Branches
No related tags found
No related merge requests found
...@@ -85,6 +85,10 @@ describe('modules/versioning/npm/index', () => { ...@@ -85,6 +85,10 @@ describe('modules/versioning/npm/index', () => {
${'>= 0.0.1 < 1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${'>= 1.0.1 < 2'} ${'>= 0.0.1 < 1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${'>= 1.0.1 < 2'}
${'>= 0.0.1 < 1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${'>= 1.0.1 < 2'} ${'>= 0.0.1 < 1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${'>= 1.0.1 < 2'}
${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${null} ${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'replace'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'widen'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'pin'} | ${'1.0.0'} | ${'1.0.1'} | ${'1.0.1'}
${'*'} | ${'update-lockfile'} | ${'1.0.0'} | ${'1.0.1'} | ${'*'}
${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'<=1.2.3'} ${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'<=1.2.3'}
${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.4'} | ${'<=1.2.4'} ${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.4'} | ${'<=1.2.4'}
${'>=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'>=1.2.3'} ${'>=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'>=1.2.3'}
......
...@@ -64,7 +64,10 @@ export function getNewValue({ ...@@ -64,7 +64,10 @@ export function getNewValue({
currentVersion, currentVersion,
newVersion, newVersion,
}: NewValueConfig): string | null { }: NewValueConfig): string | null {
if (rangeStrategy === 'bump' && isSemVerXRange(currentValue)) { if (
!['pin', 'update-lockfile'].includes(rangeStrategy) &&
isSemVerXRange(currentValue)
) {
return null; return null;
} }
if (rangeStrategy === 'pin' || isVersion(currentValue)) { if (rangeStrategy === 'pin' || isVersion(currentValue)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment