🐛 Fix OTP version null check (#211)

* Fix OTP version null check

* Revert "Fix OTP version null check"

This reverts commit 2c433c16ac.

* Check that the resolved versions contain the spec.

* Only perform semver version resolution when spec is not an rc and version-type is not strict

* Move version inclusion check to the end of the function, when we may have prepended a 'v'

* Refactor function return

* Add test case for strict version resolving a spec that is no available version
This commit is contained in:
Christoph Grothaus
2023-06-15 15:45:56 +02:00
committed by GitHub
parent 54d4f15c75
commit df9a60921b
3 changed files with 17 additions and 0 deletions
+5
View File
@@ -10247,6 +10247,11 @@ function getVersionFromSpec(spec, versions, maybePrependWithV0) {
if (maybePrependWithV0 && v != null) { if (maybePrependWithV0 && v != null) {
v = maybePrependWithV(v) v = maybePrependWithV(v)
} }
if (!versions.includes(v)) {
v = null
}
return v return v
} }
+5
View File
@@ -375,6 +375,11 @@ function getVersionFromSpec(spec, versions, maybePrependWithV0) {
if (maybePrependWithV0 && v != null) { if (maybePrependWithV0 && v != null) {
v = maybePrependWithV(v) v = maybePrependWithV(v)
} }
if (!versions.includes(v)) {
v = null
}
return v return v
} }
+7
View File
@@ -413,6 +413,13 @@ async function testGetVersionFromSpec() {
got = setupBeam.getVersionFromSpec(spec, versions) got = setupBeam.getVersionFromSpec(spec, versions)
assert.deepStrictEqual(got, expected) assert.deepStrictEqual(got, expected)
simulateInput('version-type', before) simulateInput('version-type', before)
before = simulateInput('version-type', 'strict')
spec = '22.3.4.3'
expected = null
got = setupBeam.getVersionFromSpec(spec, versions)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', before)
} }
async function testParseVersionFile() { async function testParseVersionFile() {