mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-22 22:56:07 +00:00
🐛 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:
committed by
GitHub
parent
54d4f15c75
commit
df9a60921b
Vendored
+5
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user