Compare commits

...

11 Commits

Author SHA1 Message Date
Bark
3719604eb3
Merge 8066dc851168cd13a7b116244ba0ca105add1f8c into 74eb3960996576cd2f8ca8709574fc46e4c4f923 2025-02-05 18:12:30 +08:00
Jordan Harband
74eb396099
[Dev Deps] update markdown-link-check 2025-02-04 12:37:59 -08:00
Stiliyan Tonev (Bark)
8066dc8511 remove test from slow folder 2024-07-31 16:44:25 +03:00
Stiliyan Tonev (Bark)
59b40b8ae7 Rookie mistake from my side, forgot to clean-up the nvmrc, which caused other tests to fail.
Updated version color printing test because it did not pass.
2024-07-31 16:42:03 +03:00
Stiliyan Tonev (Bark)
ce777fa5cf Merge branch 'fork-dev' of https://github.com/userwiths/nvm into fork-dev 2024-07-31 12:02:53 +03:00
Stiliyan Tonev (Bark)
650b069bb8 Seems changes done in docker do not persist, had to reapply them 2024-07-30 11:56:35 +03:00
Stiliyan Tonev (Bark)
5a28180ed6 tests: Add test to check if the message contains the relevant information. 2024-07-30 11:51:32 +03:00
Bark
05feeaa927
[Fix] nvm exec: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
2024-03-06 16:03:10 +02:00
Bark
e2ff1e7f08 fix: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
2024-03-06 16:03:10 +02:00
Atsushi Yamamoto
9f520c97db
[Tests] nvm exec/nvm run: add --silent tests
Co-authored-by: Atsushi Yamamoto <yamaatsushi927@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2016-10-11 23:43:10 -07:00
Jordan Harband
e5521cfd3c
[actions] release test needs git tags 2025-02-04 08:44:48 -08:00
7 changed files with 55 additions and 5 deletions

View File

@ -19,6 +19,8 @@ jobs:
raw.githubusercontent.com:443 raw.githubusercontent.com:443
registry.npmjs.org:443 registry.npmjs.org:443
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
fetch-tags: true
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: "14" node-version: "14"

View File

@ -7,6 +7,7 @@ unset NVM_CD_FLAGS
# shellcheck disable=SC1090,SC1091 # shellcheck disable=SC1090,SC1091
\. "$DIR/nvm.sh" --no-use \. "$DIR/nvm.sh" --no-use
nvm_rc_version > /dev/null && nvm_ensure_version_installed "$NVM_RC_VERSION";
if [ -n "$NODE_VERSION" ]; then if [ -n "$NODE_VERSION" ]; then
nvm use "$NODE_VERSION" > /dev/null || exit 127 nvm use "$NODE_VERSION" > /dev/null || exit 127
elif ! nvm use >/dev/null 2>&1; then elif ! nvm use >/dev/null 2>&1; then

View File

@ -45,7 +45,7 @@
"dockerfile_lint": "^0.3.4", "dockerfile_lint": "^0.3.4",
"doctoc": "^2.2.1", "doctoc": "^2.2.1",
"eclint": "^2.8.1", "eclint": "^2.8.1",
"markdown-link-check": "^3.12.2", "markdown-link-check": "^3.13.6",
"replace": "^1.2.2", "replace": "^1.2.2",
"semver": "^7.6.3", "semver": "^7.6.3",
"urchin": "^0.0.5" "urchin": "^0.0.5"

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -x
\. ../../nvm.sh
NVM_TEST_VERSION=v0.42
# Write it to nvmrc
echo "$NVM_TEST_VERSION" > .nvmrc
OUTPUT="$(../../nvm-exec 2>&1)";
EXPECTED="N/A: version \"${NVM_TEST_VERSION}\" is not yet installed.
You need to run \`nvm install ${NVM_TEST_VERSION}\` to install and use it.
No NODE_VERSION provided; no .nvmrc file found";
# Skip install, we want to test the error message
diff <(echo "${EXPECTED}") <(echo "${OUTPUT}")
rm .nvmrc

View File

@ -2,7 +2,7 @@
\. ../../../nvm.sh \. ../../../nvm.sh
set -e #set -e #nvm use system returns 127 and No system set message
die () { die () {
# echo "$@" ; # echo "$@" ;
@ -24,7 +24,7 @@ fi
# default system color # default system color
nvm use system nvm use system
OUTPUT=$(nvm_print_versions system) OUTPUT=$(nvm_print_versions system)
FORMAT="\033[0;32m-> %12s\033[0m" FORMAT="\033[0;33m%15s\033[0m"
VERSION='system' VERSION='system'
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
@ -34,7 +34,7 @@ nvm_ls_current() { echo "current";}
# default current color # default current color
OUTPUT=$(nvm_print_versions current) OUTPUT=$(nvm_print_versions current)
FORMAT="\033[0;32m-> %12s\033[0m" FORMAT="\033[0;32m->%13s\033[0m"
VERSION="current" VERSION="current"
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
@ -43,7 +43,7 @@ EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")
# custom current color # custom current color
nvm set-colors YCMGR nvm set-colors YCMGR
OUTPUT=$(nvm_print_versions current) OUTPUT=$(nvm_print_versions current)
FORMAT="\033[1;35m-> %12s\033[0m" FORMAT="\033[1;35m->%13s\033[0m"
VERSION="current" VERSION="current"
EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}") EXPECTED_OUTPUT=$(command printf -- "${FORMAT}\\n" "${VERSION}")

View File

@ -0,0 +1,28 @@
#!/bin/sh
set -ex
die () { echo "$@" ; exit 1; }
. ../../../nvm.sh
echo "0.10.7" > .nvmrc
# Check nvm run without --silent
OUTPUT="$(nvm run --version)"
EXPECTED_OUTPUT="Found '${PWD}/.nvmrc' with version <0.10.7>
Running node v0.10.7 (npm v1.2.21)
v0.10.7"
[ ">${OUTPUT}<" = ">${EXPECTED_OUTPUT}<" ] \
|| die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<"
OUTPUT="$(nvm run --silent --version)"
EXPECTED_OUTPUT="v0.10.7"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] \
|| die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<"
# Output shouldn't be silent if --silent flag is not at the third argument position
OUTPUT="$(nvm run --version --silent)"
EXPECTED_OUTPUT=""
[ "${OUTPUT}" != "${EXPECTED_OUTPUT}" ] \
|| die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"