fix(pep440): keep spacing consistency for complex ranges

This commit is contained in:
Rhys Arkins 2019-07-29 08:17:58 +02:00
parent 7620fcbca8
commit 77cd757bc9
2 changed files with 6 additions and 1 deletions

View file

@ -76,7 +76,7 @@ function getNewValue(
logger.warn('Arbitrary equality not supported: ' + currentValue);
return null;
}
const result = ranges
let result = ranges
.map(range => {
// used to exclude versions,
// we assume that's for a good reason
@ -133,6 +133,10 @@ function getNewValue(
.filter(Boolean)
.join(', ');
if (result.includes(', ') && !currentValue.includes(', ')) {
result = result.replace(/, /g, ',');
}
if (!satisfies(toVersion, result)) {
// we failed at creating the range
logger.error(

View file

@ -108,6 +108,7 @@ describe('pep440.getNewValue()', () => {
// complex ranges
['~=1.1.0, !=1.1.1', '~=1.2.3, !=1.1.1'],
['~=1.1.0,!=1.1.1', '~=1.2.3,!=1.1.1'],
// invalid & not supported
[' ', ' '],