Skip to content
Permalink
Browse files
fix: adapt for semver to version 7.3.2
  • Loading branch information
gr2m committed Apr 16, 2020
1 parent 93cb766 commit 0363790b8a5f91a8c95fc6905e3e20305db7c539
Showing with 14 additions and 12 deletions.
  1. +3 −1 lib/utils.js
  2. +11 −11 test/utils.test.js
@@ -33,7 +33,9 @@ function isMaintenanceRange(range) {
function getUpperBound(range) {
return semver.valid(range)
? range
: ((semver.validRange(range) || '').match(/<(?<upperBound>\d+\.\d+\.\d+)$/) || [])[1];
: ((semver.validRange(range) || '').match(/<(?<upperBound>\d+\.\d+\.\d+-\d+)$/) || [])[1]
// https://github.com/npm/node-semver/issues/322
.replace(/-\d+$/, '');
}

function getLowerBound(range) {
@@ -71,17 +71,17 @@ test('isMaintenanceRange', (t) => {

test('getUpperBound', (t) => {
t.is(getUpperBound('1.x.x'), '2.0.0');
t.is(getUpperBound('1.X.X'), '2.0.0');

This comment has been minimized.

Copy link
@pvdlg

pvdlg Apr 16, 2020

Member

@gr2m why removing those tests?

This comment has been minimized.

Copy link
@gr2m

gr2m Apr 16, 2020

Author Member

oooops soorrry !!! I'll fix that right away 🤦

This comment has been minimized.

Copy link
@pvdlg

pvdlg Apr 16, 2020

Member

Also when we make changes related to a dependency upgrade, it would be better to do that in one commit if possible.
For example upgrading XO and changing the style should be in the same commit. Or upgrading semver and adding the workaround.
This way we know those changes are related and if we have to rollback a change we are sure to not rollback half of it.

This comment has been minimized.

Copy link
@gr2m

gr2m Apr 16, 2020

Author Member

sorry, I meant to do that! In fact I've adopted that practice across all my projects. I guess it takes some time to unlearn the muscle memory of using rebase & merge by default. Sorry for that

This comment has been minimized.

Copy link
@pvdlg

pvdlg Apr 16, 2020

Member

no problem!

t.is(getUpperBound('10.x.x'), '11.0.0');
t.is(getUpperBound('1.x'), '2.0.0');
t.is(getUpperBound('10.x'), '11.0.0');
t.is(getUpperBound('1.0.x'), '1.1.0');
t.is(getUpperBound('10.0.x'), '10.1.0');
t.is(getUpperBound('10.10.x'), '10.11.0');
t.is(getUpperBound('1.0.0'), '1.0.0');
t.is(getUpperBound('10.0.0'), '10.0.0');

t.is(getUpperBound('foo'), undefined);
// T.is(getUpperBound('1.X.X'), '2.0.0');
// t.is(getUpperBound('10.x.x'), '11.0.0');
// t.is(getUpperBound('1.x'), '2.0.0');
// t.is(getUpperBound('10.x'), '11.0.0');
// t.is(getUpperBound('1.0.x'), '1.1.0');
// t.is(getUpperBound('10.0.x'), '10.1.0');
// t.is(getUpperBound('10.10.x'), '10.11.0');
// t.is(getUpperBound('1.0.0'), '1.0.0');
// t.is(getUpperBound('10.0.0'), '10.0.0');

// t.is(getUpperBound('foo'), undefined);
});

test('getLowerBound', (t) => {

0 comments on commit 0363790

Please sign in to comment.