Files
nvm/test/fast/Unit tests/nvm_is_alpha_version
T
Jordan Harband 3fda4d5542 [New] select versions by category: alpha, lts, non-lts, iojs; exclude alphas by default
Node 27 and later publish Alpha prereleases, like `v27.0.0-alpha.1.0.0`, in the main `index.tab`,
so `nvm install node` or `nvm install 27` would otherwise pick one.
Every version is in exactly one category: `alpha` and `lts` or `non-lts` (by index.tab's LTS column) on the node mirror, and `iojs` on the io.js mirror.
Commands select from every category but `alpha`, unless `$NVM_ONLY` lists others,
and every command that selects or lists versions takes `--only=<categories>` to override both;
an exact alpha needs `alpha` selected, like any other.
An LTS selection, like `--lts` or an `lts/` version, can't combine with an `--only=` that excludes `lts`.
Telling installed `lts` and `non-lts` versions apart uses the recorded LTS status, and fails rather than guess without it.
`nvm alias` also stores `--only=`, so `nvm alias default --only=alpha node` makes the latest installed alpha the default, including in a new shell.
2026-10-21 14:09:18 -07:00

17 lines
707 B
Bash
Executable File

#!/bin/sh
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
for VERSION in 'v27.0.0-alpha.0.0.0' 'v27.0.0-alpha.1.10.2' '27.0.0-alpha.1.2.0' 'v28.1.2-alpha.10.20.30'; do
nvm_is_alpha_version "${VERSION}" || die "${VERSION} should be an alpha version"
done
for VERSION in '' 'v27.0.0' 'v27.0.0-alpha.1.0' 'v27.0.0-alpha.1' 'v27.0.0-alpha.1.0.0.0' 'v27.0.0-alpha.1..0' 'v27.0.0-alpha.1.0.0-' \
'v27.0-alpha.1.0.0' 'v27.0.0-alpha.' 'v27.0.0-alpha.a.b.c' 'v27.0.0-beta.1.0.0' 'iojs-v3.0.0' 'iojs-v27.0.0-alpha.1.0.0' \
'v11.0.0-nightly201810011be804d625' 'v24.0.0-rc.1' 'node' 'lts/*' 'system'; do
! nvm_is_alpha_version "${VERSION}" || die "${VERSION} should not be an alpha version"
done