Compare commits

...

8 Commits

Author SHA1 Message Date
Jordan Harband
4c3edc5e56 [actions] migrate Travis CI tests to GitHub Actions
Some checks failed
Tests on Windows: `nvm install` / WSL nvm install (, 16, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 18, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 21, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, --lts, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 11, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Debian) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Ubuntu-20.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Debian) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Ubuntu-20.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, --lts, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 10, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 11, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 12, Alpine) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (, 14, Alpine) (push) Has been cancelled
Tests: shellcheck / shellcheck (push) Has been cancelled
Tests: `nvm install-latest-npm` / nvm install-latest-npm (push) Has been cancelled
Tests: nvm install with set -e / test (push) Has been cancelled
Tests: nvm install with set -e / finisher (push) Has been cancelled
Tests: fast / all fast tests (push) Has been cancelled
Tests: installation_iojs / all installation_iojs tests (push) Has been cancelled
Tests: installation_node / all installation_node tests (push) Has been cancelled
Tests: xenial / all xenial tests (push) Has been cancelled
urchin tests / all test suites, all shells (push) Has been cancelled
Tests on Windows: `nvm install` / tests, on windows (push) Has been cancelled
2026-01-27 10:31:07 -08:00
Jordan Harband
35212c1346 [Fix] nvm_has_colors: also check if stdout is a terminal 2026-01-27 10:31:07 -08:00
Jordan Harband
d2f93c1c8e [Tests] mock node in nvm_die_on_prefix test 2026-01-26 22:34:24 -08:00
Jordan Harband
f9dbad9832 [Tests] clean up .nvmrc after nvm-exec test 2026-01-26 22:34:07 -08:00
Jordan Harband
c451e7a4c8 [Tests] set $_ before sourcing nvm.sh in fast tests
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location.
Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
2026-01-26 21:41:57 -08:00
Jordan Harband
9ba422e561 [Fix] nvm_strip_path: avoid gawk-specific RT variable for mawk compatibility 2026-01-26 22:33:58 -08:00
Jordan Harband
38ffc713a7 [Fix] nvm_get_default_packages: use portable awk patterns
Replace POSIX `[[:space:]]` character class with `[ \t]` for
mawk compatibility on Ubuntu 16.04.
2026-01-26 16:59:11 -08:00
Jordan Harband
aa1d829102 [Fix] nvm_install_source: explicitly set SHELL=/bin/sh for make
Old Node.js versions have Makefiles with unquoted glob patterns like
`rm -f *.o` that fail in zsh's strict glob mode. By passing
SHELL=/bin/sh to make, we ensure POSIX-compliant shell behavior
regardless of what shell nvm is running in.
2026-01-26 15:07:01 -08:00
173 changed files with 881 additions and 147 deletions

101
.github/workflows/tests-fast.yml vendored Normal file
View File

@@ -0,0 +1,101 @@
name: 'Tests: fast'
on: [push, pull_request]
permissions:
contents: read
jobs:
fast:
permissions:
contents: read
name: 'fast (${{ matrix.shell }}, ${{ matrix.awk }})'
runs-on: ubuntu-latest
defaults:
run:
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
strategy:
fail-fast: false
matrix:
shell:
- sh
- bash
- dash
- zsh
# - ksh
awk:
- gawk
- mawk
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
allowed-endpoints:
github.com:443
registry.npmjs.org:443
raw.githubusercontent.com:443
nodejs.org:443
iojs.org:443
unofficial-builds.nodejs.org:443
azure.archive.ubuntu.com:80
packages.microsoft.com:443
registry-1.docker.io:443
auth.docker.io:443
production.cloudflare.docker.com:443
- uses: actions/checkout@v6
with:
submodules: true
- name: Install zsh, additional shells, and awk variant
run: |
sudo apt-get update
sudo apt-get install -y zsh ${{ matrix.awk }}
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
sudo apt-get install -y ${{ matrix.shell }}
fi
# Set the selected awk as the default
sudo update-alternatives --set awk /usr/bin/${{ matrix.awk }}
shell: bash
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
- run: awk --version 2>&1 | head -1 || awk -W version 2>&1 | head -1
- run: curl --version
- run: wget --version
- uses: ljharb/actions/node/install@main
name: 'npm install && version checks'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm ls urchin
- run: npx which urchin
- run: env
- name: Hide system node
run: |
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
shell: bash
- name: Run fast tests
run: |
URCHIN_PATH="$(npx which urchin)"
unset NVM_CD_FLAGS NVM_BIN NVM_INC
export NVM_DIR="${{ github.workspace }}"
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
make TERM=xterm-256color TEST_SUITE="fast" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
- name: Restore system node
if: always()
run: |
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
shell: bash
all:
permissions:
contents: none
name: 'all fast tests'
needs: [fast]
runs-on: ubuntu-latest
steps:
- run: true

View File

@@ -0,0 +1,99 @@
name: 'Tests: installation_iojs'
on: [push, pull_request]
permissions:
contents: read
jobs:
installation_iojs_without_curl:
permissions:
contents: read
name: 'installation_iojs without curl (${{ matrix.shell }})'
runs-on: ubuntu-latest
defaults:
run:
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
strategy:
fail-fast: false
matrix:
shell:
- sh
- bash
- dash
- zsh
# - ksh
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
allowed-endpoints:
github.com:443
registry.npmjs.org:443
raw.githubusercontent.com:443
nodejs.org:443
iojs.org:443
azure.archive.ubuntu.com:80
packages.microsoft.com:443
- uses: actions/checkout@v6
with:
submodules: true
- name: Install zsh and additional shells
run: |
sudo apt-get update
sudo apt-get install -y zsh
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
sudo apt-get install -y ${{ matrix.shell }}
fi
shell: bash
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
- run: wget --version
- uses: ljharb/actions/node/install@main
name: 'npm install && version checks'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm ls urchin
- run: npx which urchin
- name: Remove curl
run: sudo apt-get remove curl -y
shell: bash
- run: '! command -v curl'
shell: bash
- run: env
- name: Hide system node
run: |
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
shell: bash
- name: Run installation_iojs tests
run: |
URCHIN_PATH="$(npx which urchin)"
unset NVM_CD_FLAGS NVM_BIN NVM_INC
export NVM_DIR="${{ github.workspace }}"
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
make TERM=xterm-256color TEST_SUITE="installation_iojs" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
- name: Restore system node
if: always()
run: |
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
shell: bash
- name: Restore curl
if: always()
run: sudo apt-get install curl -y
shell: bash
all:
permissions:
contents: none
name: 'all installation_iojs tests'
needs: [installation_iojs_without_curl]
runs-on: ubuntu-latest
steps:
- run: true

View File

@@ -0,0 +1,122 @@
name: 'Tests: installation_node'
on: [push, pull_request]
permissions:
contents: read
jobs:
installation_node:
permissions:
contents: read
name: "installation_node (${{ matrix.shell }}${{ matrix.without_curl && ', without curl' || '' }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shell:
- sh
- bash
- dash
- zsh
# - ksh
without_curl:
- false
- true
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
allowed-endpoints:
github.com:443
registry.npmjs.org:443
raw.githubusercontent.com:443
nodejs.org:443
iojs.org:443
azure.archive.ubuntu.com:80
packages.microsoft.com:443
archive.ubuntu.com:80
security.ubuntu.com:80
production.cloudflare.docker.com:443
registry-1.docker.io:443
auth.docker.io:443
- uses: actions/checkout@v6
with:
submodules: true
- uses: ljharb/actions/node/install@main
name: 'npm install && version checks'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm ls urchin
- run: npx which urchin
- name: Run installation_node tests in container
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
-e "TEST_SHELL=${{ matrix.shell }}" \
-e "TERM=xterm-256color" \
-e "DEBIAN_FRONTEND=noninteractive" \
-e "GITHUB_ACTIONS=true" \
-e "WITHOUT_CURL=${{ matrix.without_curl }}" \
ubuntu:16.04 \
bash -c '
set -ex
# Retry apt-get update up to 5 times due to flaky Ubuntu mirrors
# apt-get update can return 0 even with partial failures, so check for warnings
for i in 1 2 3 4 5; do
if apt-get update 2>&1 | tee /tmp/apt-update.log | grep -qE "^(W:|E:|Err:)"; then
echo "apt-get update had warnings/errors, attempt $i/5"
cat /tmp/apt-update.log
sleep $((i * 5))
else
break
fi
done
apt-get install -y git curl wget make build-essential python zsh libssl-dev
if [ "$TEST_SHELL" != "sh" ] && [ "$TEST_SHELL" != "bash" ]; then
apt-get install -y $TEST_SHELL || true
fi
# Use nvm to install Node.js for running urchin
# Node 16 is the last version supporting GLIBC 2.23 (Ubuntu 16.04)
export NVM_DIR="/workspace"
. /workspace/nvm.sh
nvm install 16
nvm use 16
npm ls urchin
URCHIN_PATH="$(npx which urchin)"
# Remove curl if testing without it
if [ "$WITHOUT_CURL" = "true" ]; then
apt-get remove curl -y
! command -v curl
fi
# Now clean up nvm state for the actual tests, but keep NVM_DIR set
nvm deactivate || true
nvm unalias default || true
unset NVM_CD_FLAGS NVM_BIN NVM_INC
export PATH="$(echo "$PATH" | tr ":" "\n" | grep -v "\.nvm" | grep -v "toolcache" | tr "\n" ":")"
# Clean any cached files from the nvm install above
rm -rf "$NVM_DIR/.cache" "$NVM_DIR/versions" "$NVM_DIR/alias"
make TEST_SUITE="installation_node" SHELL="$TEST_SHELL" URCHIN="$URCHIN_PATH" test-$TEST_SHELL
'
all:
permissions:
contents: none
name: 'all installation_node tests'
needs: [installation_node]
runs-on: ubuntu-latest
steps:
- run: true

112
.github/workflows/tests-xenial.yml vendored Normal file
View File

@@ -0,0 +1,112 @@
name: 'Tests: xenial'
on: [push, pull_request]
permissions:
contents: read
jobs:
xenial:
permissions:
contents: read
name: 'xenial (${{ matrix.shell }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shell:
- sh
- bash
- dash
- zsh
# - ksh
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
allowed-endpoints:
github.com:443
registry.npmjs.org:443
raw.githubusercontent.com:443
nodejs.org:443
iojs.org:443
azure.archive.ubuntu.com:80
packages.microsoft.com:443
archive.ubuntu.com:80
security.ubuntu.com:80
production.cloudflare.docker.com:443
registry-1.docker.io:443
auth.docker.io:443
- uses: actions/checkout@v6
with:
submodules: true
- uses: ljharb/actions/node/install@main
name: 'npm install && version checks'
with:
node-version: 'lts/*'
skip-ls-check: true
- run: npm ls urchin
- run: npx which urchin
- name: Run xenial tests in container
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
-e "TEST_SHELL=${{ matrix.shell }}" \
-e "TERM=xterm-256color" \
-e "DEBIAN_FRONTEND=noninteractive" \
-e "GITHUB_ACTIONS=true" \
ubuntu:16.04 \
bash -c '
set -ex
# Retry apt-get update up to 5 times due to flaky Ubuntu mirrors
# apt-get update can return 0 even with partial failures, so check for warnings
for i in 1 2 3 4 5; do
if apt-get update 2>&1 | tee /tmp/apt-update.log | grep -qE "^(W:|E:|Err:)"; then
echo "apt-get update had warnings/errors, attempt $i/5"
cat /tmp/apt-update.log
sleep $((i * 5))
else
break
fi
done
apt-get install -y git curl wget make build-essential python zsh libssl-dev
if [ "$TEST_SHELL" != "sh" ] && [ "$TEST_SHELL" != "bash" ]; then
apt-get install -y $TEST_SHELL || true
fi
# Use nvm to install Node.js for running urchin
# Node 16 is the last version supporting GLIBC 2.23 (Ubuntu 16.04)
export NVM_DIR="/workspace"
. /workspace/nvm.sh
nvm install 16
nvm use 16
npm ls urchin
URCHIN_PATH="$(npx which urchin)"
# Now clean up nvm state for the actual tests, but keep NVM_DIR set
nvm deactivate || true
nvm unalias default || true
unset NVM_CD_FLAGS NVM_BIN NVM_INC
export PATH="$(echo "$PATH" | tr ":" "\n" | grep -v "\.nvm" | grep -v "toolcache" | tr "\n" ":")"
# Clean any cached files from the nvm install above
rm -rf "$NVM_DIR/.cache" "$NVM_DIR/versions" "$NVM_DIR/alias"
make TEST_SUITE="xenial" SHELL="$TEST_SHELL" URCHIN="$URCHIN_PATH" test-$TEST_SHELL
'
all:
permissions:
contents: none
name: 'all xenial tests'
needs: [xenial]
runs-on: ubuntu-latest
steps:
- run: true

View File

@@ -1,94 +0,0 @@
language: generic
dist: focal
addons:
apt:
packages:
- zsh
# - ksh
# - gcc-4.8
# - g++-4.8
# https://gist.github.com/iedemam/9830045
git:
submodules: false
cache:
ccache: true
directories:
- $TRAVIS_BUILD_DIR/.cache
- $TRAVIS_BUILD_DIR/node_modules
before_install:
- sudo sed -i 's/mozilla\/DST_Root_CA_X3.crt/!mozilla\/DST_Root_CA_X3.crt/g' /etc/ca-certificates.conf
- sudo update-ca-certificates -f
# https://gist.github.com/iedemam/9830045
- sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
- git submodule update --init --recursive
- $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL
- curl --version
- wget --version
- bash --version | head
- zsh --version
- dpkg -s dash | grep ^Version | awk '{print $2}'
# install python
- pyenv local 2.7.18 || pyenv install 2.7.18
- pyenv local 2.7.18 || echo 'pyenv failed'
- python -V
install:
- if [ -z "${SHELLCHECK-}" ]; then nvm install 16 && nvm unalias default && npm install && npm prune && npm ls urchin doctoc eclint dockerfile_lint; fi
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
script:
- if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ] || [ "${TEST_SUITE}" = 'xenial' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
before_cache:
- if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi
jobs:
include:
- env: SHELL=bash TEST_SUITE=installation_node
dist: xenial
- env: SHELL=bash TEST_SUITE=installation_node WITHOUT_CURL=1
dist: xenial
- env: SHELL=sh TEST_SUITE=installation_node
dist: xenial
- env: SHELL=sh TEST_SUITE=installation_node WITHOUT_CURL=1
dist: xenial
- env: SHELL=dash TEST_SUITE=installation_node
dist: xenial
- env: SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=1
dist: xenial
- env: SHELL=zsh TEST_SUITE=installation_node
dist: xenial
- env: SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=1
dist: xenial
#- env: SHELL=ksh TEST_SUITE=installation_node
# dist: xenial
#- env: SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=1
# dist: xenial
- env: SHELL=bash TEST_SUITE=xenial
dist: xenial
- env: SHELL=sh TEST_SUITE=xenial
dist: xenial
- env: SHELL=dash TEST_SUITE=xenial
dist: xenial
- env: SHELL=zsh TEST_SUITE=xenial
dist: xenial
#- env: SHELL=ksh TEST_SUITE=xenial
# dist: xenial
env:
global:
- CXX=g++
- CC=gcc
- PATH="$(echo $PATH | sed 's/::/:/')"
- PATH="/usr/lib/ccache/:$PATH"
- NVM_DIR="${TRAVIS_BUILD_DIR}"
matrix:
- SHELL=sh TEST_SUITE=fast
- SHELL=dash TEST_SUITE=fast
- SHELL=bash TEST_SUITE=fast
- SHELL=zsh TEST_SUITE=fast
# - SHELL=ksh TEST_SUITE=fast
- SHELL=sh TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1

View File

@@ -6,7 +6,7 @@
</a>
# Node Version Manager [![Build Status](https://app.travis-ci.com/nvm-sh/nvm.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.3-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)
# Node Version Manager [![Tests](https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml/badge.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.3-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)
<!-- To update this table of contents, ensure you have run `npm install` then `npm run doctoc` -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -1038,7 +1038,7 @@ To change the user directory and/or account name follow the instructions [here](
[1]: https://github.com/nvm-sh/nvm.git
[2]: https://github.com/nvm-sh/nvm/blob/v0.40.3/install.sh
[3]: https://app.travis-ci.com/nvm-sh/nvm
[3]: https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml
[4]: https://github.com/nvm-sh/nvm/releases/tag/v0.40.3
[Urchin]: https://git.sdf.org/tlevine/urchin
[Fish]: https://fishshell.com

31
nvm.sh
View File

@@ -83,7 +83,7 @@ nvm_has_colors() {
if nvm_has tput; then
NVM_NUM_COLORS="$(command tput -T "${TERM:-vt100}" colors)"
fi
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
[ -t 1 ] && [ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
}
nvm_curl_libz_support() {
@@ -978,13 +978,18 @@ nvm_strip_path() {
nvm_err '${NVM_DIR} not set!'
return 1
fi
command printf %s "${1-}" | command awk -v NVM_DIR="${NVM_DIR}" -v RS=: '
local RESULT
RESULT="$(command printf %s "${1-}" | command awk -v NVM_DIR="${NVM_DIR}" -v RS=: '
index($0, NVM_DIR) == 1 {
path = substr($0, length(NVM_DIR) + 1)
if (path ~ "^(/versions/[^/]*)?/[^/]*'"${2-}"'.*$") { next }
}
# The final RT will contain a colon if the input has a trailing colon, or a null string otherwise
{ printf "%s%s", sep, $0; sep=RS } END { printf "%s", RT }'
{ printf "%s%s", sep, $0; sep=RS }')"
# mawk does not support RT, so preserve trailing colon manually
case "${1-}" in
*:) command printf '%s:' "${RESULT}" ;;
*) command printf '%s' "${RESULT}" ;;
esac
}
nvm_change_path() {
@@ -2642,18 +2647,24 @@ nvm_install_source() {
NVM_OS="$(nvm_get_os)"
local make
make='make'
local MAKE_CXX
# For old Node.js versions (< 0.12), explicitly set SHELL=/bin/sh to avoid
# issues with zsh's strict glob handling in Makefiles with unquoted globs
local MAKE_SHELL_OVERRIDE
if nvm_version_greater "0.12.0" "${VERSION}"; then
MAKE_SHELL_OVERRIDE=' SHELL=/bin/sh'
fi
make="make${MAKE_SHELL_OVERRIDE-}"
case "${NVM_OS}" in
'freebsd' | 'openbsd')
make='gmake'
make="gmake${MAKE_SHELL_OVERRIDE-}"
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;;
'darwin')
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;;
'aix')
make='gmake'
make="gmake${MAKE_SHELL_OVERRIDE-}"
;;
esac
if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to "$(nvm_clang_version)" 3.5; then
@@ -4524,9 +4535,9 @@ nvm_get_default_packages() {
NVM_DEFAULT_PACKAGE_FILE="${NVM_DIR}/default-packages"
if [ -f "${NVM_DEFAULT_PACKAGE_FILE}" ]; then
command awk -v filename="${NVM_DEFAULT_PACKAGE_FILE}" '
/^[[:space:]]*#/ { next } # Skip lines that begin with #
/^[[:space:]]*$/ { next } # Skip empty lines
/[[:space:]]/ && !/^[[:space:]]*#/ {
/^[ \t]*#/ { next } # Skip lines that begin with #
/^[ \t]*$/ { next } # Skip empty lines
/[ \t]/ && !/^[ \t]*#/ {
print "Only one package per line is allowed in `" filename "`. Please remove any lines with multiple space-separated values." > "/dev/stderr"
err = 1
exit 1

View File

@@ -4,6 +4,7 @@ die() { echo "$@" ; exit 1; }
export NVM_DIR="$(cd ../../.. && pwd)"
: nvm.sh
\. "${NVM_DIR}/nvm.sh"
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh
@@ -14,11 +15,11 @@ fi
nvm alias test-stable-1 0.0.2 || die '`nvm alias test-stable-1 0.0.2` failed'
OUTPUT="$(nvm alias test-stable-1 | strip_colors)"
EXPECTED_OUTPUT='test-stable-1 -> 0.0.2 (-> v0.0.2)'
EXPECTED_OUTPUT='test-stable-1 -> 0.0.2 (-> v0.0.2 *)'
echo "$OUTPUT" | \grep -F "$EXPECTED_OUTPUT" || die "nvm alias test-stable-1 0.0.2 did not set test-stable-1 to 0.0.2: got '$OUTPUT'"
nvm alias test-stable-1 0.0.1 || die '`nvm alias test-stable-1 0.0.1` failed'
OUTPUT="$(nvm alias test-stable-1 | strip_colors)"
EXPECTED_OUTPUT='test-stable-1 -> 0.0.1 (-> v0.0.1)'
EXPECTED_OUTPUT='test-stable-1 -> 0.0.1 (-> v0.0.1 *)'
echo "$OUTPUT" | \grep -F "$EXPECTED_OUTPUT" || die "nvm alias test-stable-1 0.0.1 did not set test-stable-1 to 0.0.1: got '$OUTPUT'"

View File

@@ -1,4 +1,5 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
[ $(nvm alias test-stable-1 | wc -l) = '2' ]

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh
@@ -9,18 +10,18 @@ NVM_ALIAS_OUTPUT=$(nvm alias | strip_colors)
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
echo "$NVM_ALIAS_OUTPUT" | \grep -F "stable -> $EXPECTED_STABLE (-> $STABLE_VERSION) (default)" \
echo "$NVM_ALIAS_OUTPUT" | \grep -F "stable -> $EXPECTED_STABLE (-> $STABLE_VERSION *) (default)" \
|| die "nvm alias did not contain the default local stable node version; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F "node -> stable (-> $STABLE_VERSION) (default)" \
echo "$NVM_ALIAS_OUTPUT" | \grep -F "node -> stable (-> $STABLE_VERSION *) (default)" \
|| die "nvm alias did not contain the default local stable node version under 'node'; got '$NVM_ALIAS_OUTPUT'"
EXPECTED_UNSTABLE="$(nvm_print_implicit_alias local unstable)"
UNSTABLE_VERSION="$(nvm_version "$EXPECTED_UNSTABLE")"
echo "$NVM_ALIAS_OUTPUT" | \grep -F "unstable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION) (default)" \
echo "$NVM_ALIAS_OUTPUT" | \grep -F "unstable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION *) (default)" \
|| die "nvm alias did not contain the default local unstable node version; got '$NVM_ALIAS_OUTPUT'"
EXPECTED_IOJS="$(nvm_print_implicit_alias local iojs)"
IOJS_VERSION="$(nvm_version "$EXPECTED_IOJS")"
echo "$NVM_ALIAS_OUTPUT" | \grep -F "iojs -> $EXPECTED_IOJS (-> $IOJS_VERSION) (default)" \
echo "$NVM_ALIAS_OUTPUT" | \grep -F "iojs -> $EXPECTED_IOJS (-> $IOJS_VERSION *) (default)" \
|| die "nvm alias did not contain the default local iojs version; got '$NVM_ALIAS_OUTPUT'"

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh
@@ -34,16 +35,16 @@ nvm alias iojs unstable
NVM_ALIAS_OUTPUT=$(nvm alias | strip_colors)
echo "$NVM_ALIAS_OUTPUT" | command grep -F "stable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION)" \
echo "$NVM_ALIAS_OUTPUT" | command grep -F "stable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION *)" \
|| die "nvm alias did not contain the overridden 'stable' alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | command grep -F "unstable -> $EXPECTED_STABLE (-> $STABLE_VERSION)" \
echo "$NVM_ALIAS_OUTPUT" | command grep -F "unstable -> $EXPECTED_STABLE (-> $STABLE_VERSION *)" \
|| die "nvm alias did not contain the overridden 'unstable' alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | command grep -F "node -> stable (-> $UNSTABLE_VERSION)" \
echo "$NVM_ALIAS_OUTPUT" | command grep -F "node -> stable (-> $UNSTABLE_VERSION *)" \
|| die "nvm alias did not contain the overridden 'node' alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | command grep -F "iojs -> unstable (-> $STABLE_VERSION)" \
echo "$NVM_ALIAS_OUTPUT" | command grep -F "iojs -> unstable (-> $STABLE_VERSION *)" \
|| die "nvm alias did not contain the overridden 'iojs' alias; got '$NVM_ALIAS_OUTPUT'"
cleanup

View File

@@ -1,48 +1,49 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo "$@" ; exit 1; }
NVM_ALIAS_OUTPUT="$(nvm alias | strip_colors)"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-1 -> 0.0.1 (-> v0.0.1)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-1 -> 0.0.1 (-> v0.0.1 *)' \
|| die "did not find test-stable-1 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-2 -> 0.0.2 (-> v0.0.2)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-2 -> 0.0.2 (-> v0.0.2 *)' \
|| die "did not find test-stable-2 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-3 -> 0.0.3 (-> v0.0.3)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-3 -> 0.0.3 (-> v0.0.3 *)' \
|| die "did not find test-stable-3 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-4 -> 0.0.4 (-> v0.0.4)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-4 -> 0.0.4 (-> v0.0.4 *)' \
|| die "did not find test-stable-4 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-5 -> 0.0.5 (-> v0.0.5)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-5 -> 0.0.5 (-> v0.0.5 *)' \
|| die "did not find test-stable-5 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-6 -> 0.0.6 (-> v0.0.6)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-6 -> 0.0.6 (-> v0.0.6 *)' \
|| die "did not find test-stable-6 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-7 -> 0.0.7 (-> v0.0.7)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-7 -> 0.0.7 (-> v0.0.7 *)' \
|| die "did not find test-stable-7 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-8 -> 0.0.8 (-> v0.0.8)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-8 -> 0.0.8 (-> v0.0.8 *)' \
|| die "did not find test-stable-8 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-9 -> 0.0.9 (-> v0.0.9)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-9 -> 0.0.9 (-> v0.0.9 *)' \
|| die "did not find test-stable-9 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-10 -> 0.0.10 (-> v0.0.10)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-10 -> 0.0.10 (-> v0.0.10 *)' \
|| die "did not find test-stable-10 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-1 -> 0.1.1 (-> v0.1.1)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-1 -> 0.1.1 (-> v0.1.1 *)' \
|| die "did not find test-unstable-1 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-2 -> 0.1.2 (-> v0.1.2)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-2 -> 0.1.2 (-> v0.1.2 *)' \
|| die "did not find test-unstable-2 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-3 -> 0.1.3 (-> v0.1.3)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-3 -> 0.1.3 (-> v0.1.3 *)' \
|| die "did not find test-unstable-3 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-4 -> 0.1.4 (-> v0.1.4)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-4 -> 0.1.4 (-> v0.1.4 *)' \
|| die "did not find test-unstable-4 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-5 -> 0.1.5 (-> v0.1.5)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-5 -> 0.1.5 (-> v0.1.5 *)' \
|| die "did not find test-unstable-5 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-6 -> 0.1.6 (-> v0.1.6)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-6 -> 0.1.6 (-> v0.1.6 *)' \
|| die "did not find test-unstable-6 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-7 -> 0.1.7 (-> v0.1.7)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-7 -> 0.1.7 (-> v0.1.7 *)' \
|| die "did not find test-unstable-7 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-8 -> 0.1.8 (-> v0.1.8)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-8 -> 0.1.8 (-> v0.1.8 *)' \
|| die "did not find test-unstable-8 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-9 -> 0.1.9 (-> v0.1.9)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-9 -> 0.1.9 (-> v0.1.9 *)' \
|| die "did not find test-unstable-9 alias; got '$NVM_ALIAS_OUTPUT'"
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-10 -> 0.1.10 (-> v0.1.10)' \
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-10 -> 0.1.10 (-> v0.1.10 *)' \
|| die "did not find test-unstable-10 alias; got '$NVM_ALIAS_OUTPUT'"

View File

@@ -3,6 +3,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../../nvm.sh
ALIAS="$(nvm_resolve_alias loopback | strip_colors)"

View File

@@ -3,6 +3,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../../nvm.sh
ALIAS="$(nvm_resolve_local_alias loopback | strip_colors)"

View File

@@ -2,6 +2,7 @@
set -ex
: nvm.sh
\. ../../../../nvm.sh
\. ../../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"

View File

@@ -4,6 +4,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
nvm alias default 0.1 >/dev/null || die "'nvm alias default 0.1' failed"
@@ -13,7 +14,7 @@ nvm_ensure_default_set 0.3 || die "'nvm_ensure_default_set' with an existing def
nvm unalias default || die "'nvm unalias default' failed"
OUTPUT="$(nvm_ensure_default_set 0.2)"
EXPECTED_OUTPUT="Creating default alias: default -> 0.2 (-> iojs-v0.2.10)"
EXPECTED_OUTPUT="Creating default alias: default -> 0.2 (-> iojs-v0.2.10 *)"
EXIT_CODE="$?"
[ "_$(echo "$OUTPUT" | strip_colors)" = "_$EXPECTED_OUTPUT" ] || die "'nvm_ensure_default_set 0.2' did not output '$EXPECTED_OUTPUT', got '$OUTPUT'"

View File

@@ -1,11 +1,14 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () { echo "$@" ; exit 1; }
set -e
nvm_has_colors() { return 0; }
nvm_get_colors(){
echo "0;95m"
}

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () {

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () {

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () {
@@ -10,6 +11,8 @@ die () {
set -e
nvm_has_colors() { return 0; }
nvm_get_colors(){
echo "0;95m"
}

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () {
@@ -8,6 +9,9 @@ die () {
}
set -e
nvm_has_colors() { return 0; }
# # # expecting in red and two grays:
OUTPUT=$(echo $(nvm_print_formatted_alias fakealias fakedest) | awk '{ print substr($0, 1, 21); }')
EXPECTED_OUTPUT="$(command printf %b "\033[0;31mfakealias\033[0m ")"

View File

@@ -4,6 +4,7 @@ die () { echo "$@" ; exit 1; }
export NVM_DIR="$(cd ../../.. && pwd)"
: nvm.sh
\. "${NVM_DIR}/nvm.sh"
EXIT_CODE=$(nvm_resolve_alias ; echo $?)

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
EXIT_CODE=$(nvm_resolve_local_alias ; echo $?)

View File

@@ -2,6 +2,7 @@
export NVM_DIR="$(cd ../../.. && pwd)"
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
nvm which nonexistent_version

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
nvm ls nonexistent_version

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
nvm ls io

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
nvm ls node_

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
export NVM_DIR="$(cd ../../.. && pwd)"
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -4,6 +4,7 @@ set -ex
export NVM_DIR="$(cd ../.. && pwd)"
: nvm.sh
\. ../../nvm.sh
nvm alias test v0.1.2

View File

@@ -6,6 +6,7 @@ die () { echo "$@" ; exit 1; }
export NVM_DIR="$(cd ../.. && pwd)"
: nvm.sh
\. ../../nvm.sh
nvm deactivate 2>&1

View File

@@ -6,6 +6,7 @@ die () { echo "$@" ; exit 1; }
export NVM_DIR="$(cd ../.. && pwd)"
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -9,6 +9,7 @@ cleanup () {
export NVM_DIR="$(cd ../.. && pwd)"
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -6,6 +6,7 @@ die () { echo "$@" ; exit 1; }
export NVM_DIR="$(cd ../.. && pwd)"
: nvm.sh
\. ../../nvm.sh
set +ex # needed for stderr

View File

@@ -6,6 +6,7 @@ ALIAS_PATH="../../alias"
echo v0.1.2 > "${ALIAS_PATH}/test"
: nvm.sh
\. ../../nvm.sh
nvm unalias test

View File

@@ -2,6 +2,7 @@
set -ex
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -2,6 +2,7 @@
set -ex
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -12,6 +12,7 @@ typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | grep -v TRAVIS_ | sort >> "${BEFORE}"
set +e # TODO: fix
: nvm.sh
\. ../../nvm.sh
set -e

View File

@@ -8,6 +8,7 @@ cleanup() {
rm -rf "$(nvm_alias_path)/foo"
}
: nvm.sh
\. ../../nvm.sh
nvm_make_alias foo foo

View File

@@ -13,6 +13,7 @@ cleanup() {
rm -rf "$(nvm_version_path "iojs-${VERSION}")"
}
: nvm.sh
\. ../../nvm.sh
nvm deactivate || die "unable to deactivate; current: >$(nvm current)<"

View File

@@ -7,6 +7,7 @@ cleanup() {
}
die() { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../nvm.sh
nvm_has_system_node() { return 0; }

View File

@@ -3,6 +3,7 @@
set -ex
export NVM_SYMLINK_CURRENT=true
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -2,6 +2,7 @@
set -ex
: nvm.sh
\. ../../nvm.sh
\. ../common.sh

View File

@@ -9,6 +9,7 @@ cleanup() {
rm .nvmrc
}
: nvm.sh
\. ../../nvm.sh
# normal .nvmrc

View File

@@ -1,9 +1,12 @@
#!/bin/bash
set -x
: nvm.sh
\. ../../nvm.sh
die () { echo "$@" ; rm .nvmrc ; exit 1; }
cleanup() { rm -f .nvmrc; }
die () { echo "$@" ; cleanup ; exit 1; }
NVM_TEST_VERSION=v0.42
@@ -18,3 +21,5 @@ No NODE_VERSION provided; no .nvmrc file found";
# Skip install, we want to test the error message
[ "${EXPECTED}" = "${OUTPUT}" ] || die "expected >${EXPECTED}<, got >${OUTPUT}<"
cleanup

View File

@@ -11,6 +11,7 @@ cleanup() {
echo "Tested nvm_echo_with_colors"
}
: nvm.sh
\. ../../../nvm.sh
OUTPUT="$(nvm_echo_with_colors "\033[0;36mCyan-colored text")"

View File

@@ -8,6 +8,7 @@ cleanup() {
echo "Tested nvm_err_with_colors"
}
: nvm.sh
\. ../../../nvm.sh
set +ex

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
die () {
@@ -10,6 +11,8 @@ die () {
set -e
nvm_has_colors() { return 0; }
nvm_get_colors(){
echo "0;95m"
}

View File

@@ -1,5 +1,6 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
#set -e #nvm use system returns 127 and No system set message
@@ -21,6 +22,8 @@ if [ -n ${NVM_COLORS} ]; then
unset NVM_COLORS
fi
nvm_has_colors() { return 0; }
# default system color
nvm use system
OUTPUT=$(nvm_print_versions system)

View File

@@ -2,6 +2,7 @@
set -ex
: nvm.sh
\. ../../nvm.sh
nvm

View File

@@ -3,5 +3,6 @@
set -ex
set -- yes
: nvm.sh
\. ../../nvm.sh
[ "$1" = yes ]

View File

@@ -1,4 +1,5 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,4 +1,5 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,4 +1,5 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -1,4 +1,5 @@
#!/bin/sh
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
nvm_install_source() {

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
REMOTE="${PWD}/mocks/nvm_ls_remote.txt"

View File

@@ -12,6 +12,7 @@ cleanup() {
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
}
: nvm.sh
\. ../../../nvm.sh
if [ -n "${NVM_COLORS-}" ]; then
export TEMP_NVM_COLORS=NVM_COLORS
@@ -32,6 +33,8 @@ printf '%s\n' "$(cat "${LTS_NAMES_PATH}" | tail -n +1)" | while IFS= read -r LTS
cp "${NVM_DIR}/alias/lts-backup/${LTS}" "${NVM_DIR}/alias/lts/"
done
nvm_has_colors() { return 0; }
nvm deactivate 2>/dev/null || die 'unable to deactivate'
\. ../../common.sh
@@ -66,12 +69,14 @@ printf '%s\n' "${LTS_LIST}" | while IFS= read -r LTS; do
INDEX=$(($INDEX + 1))
done
nvm_has_colors() { return 1; }
OUTPUT="$(nvm ls-remote lts/ARGON 2>&1)"
EXIT_CODE=$?
nvm_has_colors() { return 0; }
[ $EXIT_CODE -eq 3 ] || die "nvm ls-remote lts/ARGON did not exit 3, got '${EXIT_CODE}'"
EXPECTED_OUTPUT="LTS names must be lowercase
N/A"
N/A *"
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] || die "nvm ls-remote lts/ARGON did not output expected error message; got >${OUTPUT}< expected >${EXPECTED_OUTPUT}<"
REMOTE="${PWD}/mocks/nvm_ls_remote.txt"

View File

@@ -13,6 +13,7 @@ cleanup() {
unset TEMP_NVM_COLORS
}
: nvm.sh
\. ../../../nvm.sh
# NVM_COLORS is not set
if [ -n ${NVM_COLORS} ]; then

View File

@@ -8,6 +8,7 @@ cleanup() {
unset -f nvm_remote_version
}
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
[ "_$(nvm_add_iojs_prefix 1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix 1" did not return "iojs-v1"'

View File

@@ -6,6 +6,7 @@ cleanup () {
rm -rf ../../../alias/test
}
: nvm.sh
\. ../../../nvm.sh
OUTPUT="$(nvm_alias 2>&1)"

View File

@@ -9,6 +9,7 @@ cleanup() {
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
}
: nvm.sh
\. ../../../nvm.sh
MOCKS_DIR="${PWD}/mocks"

View File

@@ -8,6 +8,7 @@ cleanup () {
rm -rf ../../../alias/test-comment-first
}
: nvm.sh
\. ../../../nvm.sh
# Test: alias file with comment on separate line

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
[ "_$(nvm_alias_path)" = "_$NVM_DIR/alias" ] || die "nvm_alias_path did not return correct location"

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
TEST_PATH=/usr/bin:/usr/local/bin

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
TERM=dumb nvm clear-cache --help | grep 'Usage:' || die 'did not print help menu'

View File

@@ -8,6 +8,7 @@ cleanup() {
die() { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../../nvm.sh

View File

@@ -5,6 +5,7 @@ cleanup () {
}
die () { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
set -ex

View File

@@ -4,6 +4,7 @@ set -ex
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
set +x

View File

@@ -6,6 +6,7 @@ cleanup() {
die() { cleanup; echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
curl() {

View File

@@ -3,6 +3,7 @@
TEST_PWD=$(pwd)
TEST_DIR="$TEST_PWD/nvm_die_on_prefix_tmp"
: nvm.sh
\. ../../../nvm.sh
TEST_VERSION_DIR="${TEST_DIR}/version"
@@ -11,7 +12,7 @@ cleanup () {
rm -rf "$TEST_DIR"
alias nvm_has='\nvm_has'
alias npm='\npm'
unset -f nvm_has npm
unset -f nvm_has npm node
}
die () {
@@ -60,6 +61,12 @@ npm() {
fi
}
node() {
if [ "_$1" = "_-v" ]; then
echo "v0.0.0"
fi
}
OUTPUT="$(nvm_die_on_prefix 0 foo "$(nvm_version_dir new)" 2>&1)"
[ -z "$OUTPUT" ] || die "'nvm_die_on_prefix' was not a noop when directory is equivalent; got '$OUTPUT'"

View File

@@ -6,6 +6,7 @@ cleanup () {
}
die () { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
set -ex

View File

@@ -5,6 +5,7 @@ cleanup () {
}
die () { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
# bad flavor

View File

@@ -4,6 +4,7 @@
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
EXPECTED_OUTPUT="nvm_ensure_default_set: a version is required"

View File

@@ -6,6 +6,7 @@ cleanup () {
unset -f nvm_has_system_node nvm_has_system_iojs
}
: nvm.sh
\. ../../../nvm.sh
\. ../../common.sh

Some files were not shown because too many files have changed in this diff Show More