From 56d374a467bf9fbbbd075c2a967753ae7945a874 Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Wed, 13 Feb 2019 17:50:21 +0100 Subject: [PATCH] Allow plus in semver [Nexus aur bintray chocolatey dubversion myget nuget powershellgallery resharper] (#2987) * Also allow + in semver * Add test for + in semver version * Add more dashes to test version * Fix tests --- services/nexus/nexus.tester.js | 18 ++++++++++++++++++ services/test-validators.js | 4 ++-- services/validators.js | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/services/nexus/nexus.tester.js b/services/nexus/nexus.tester.js index 105b6cd7f5..b345ee15f1 100644 --- a/services/nexus/nexus.tester.js +++ b/services/nexus/nexus.tester.js @@ -86,6 +86,24 @@ t.create('live: repository version of an inexistent artifact') value: 'artifact not found', }) +t.create('snapshot version with + in version') + .get( + '/s/https/repository.jboss.org/nexus/com.progress.fuse/fusehq.json?style=_shields_test' + ) + .intercept(nock => + nock('https://repository.jboss.org/nexus') + .get('/service/local/lucene/search') + .query({ g: 'com.progress.fuse', a: 'fusehq' }) + .reply(200, { data: [{ version: '7.0.1+19-8844c122-SNAPSHOT' }] }) + ) + .expectJSONTypes( + Joi.object().keys({ + name: 'nexus', + color: 'orange', + value: isVersion, + }) + ) + t.create('search snapshot version not in latestSnapshot') .get( '/s/https/repository.jboss.org/nexus/com.progress.fuse/fusehq.json?style=_shields_test' diff --git a/services/test-validators.js b/services/test-validators.js index 590eb9cf20..cc36378faa 100644 --- a/services/test-validators.js +++ b/services/test-validators.js @@ -21,9 +21,9 @@ const isVPlusDottedVersionNClauses = withRegex(/^v\d+(\.\d+)*$/) // matches a version number with N 'clauses' // and an optional text suffix -// e.g: -beta, -preview1, -release-candidate etc +// e.g: -beta, -preview1, -release-candidate, +beta etc const isVPlusDottedVersionNClausesWithOptionalSuffix = withRegex( - /^v\d+(\.\d+)*(-.*)?$/ + /^v\d+(\.\d+)*([-+].*)?$/ ) // Simple regex for test Composer versions rule diff --git a/services/validators.js b/services/validators.js index d5b6355073..d4c221db45 100644 --- a/services/validators.js +++ b/services/validators.js @@ -21,7 +21,7 @@ module.exports = { .required(), optionalDottedVersionNClausesWithOptionalSuffix: Joi.string().regex( - /^\d+(\.\d+)*(-.*)?$/ + /^\d+(\.\d+)*([-+].*)?$/ ), // TODO This accepts URLs with query strings and fragments, which for some