Compare commits

...

7 Commits

Author SHA1 Message Date
Jordan Harband
4ba96c5974 [actions] migrate Travis CI tests to GitHub Actions
Some checks failed
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Debian) (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, 12, Ubuntu-18.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-20.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Debian) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-18.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-20.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Debian) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-18.04) (push) Has been cancelled
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-20.04) (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 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, 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` / tests, on windows (push) Has been cancelled
2026-01-26 23:12:24 -08:00
Jordan Harband
b07eb5051a [Tests] mock node in nvm_die_on_prefix test 2026-01-26 22:34:24 -08:00
Jordan Harband
7827187fc0 [Tests] clean up .nvmrc after nvm-exec test 2026-01-26 22:34:07 -08:00
Jordan Harband
1d29998546 [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
faa8585c6f [Fix] nvm_strip_path: avoid gawk-specific RT variable for mawk compatibility 2026-01-26 22:33:58 -08:00
Jordan Harband
92e0ec2ac2 [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
f05be89217 [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
171 changed files with 788 additions and 109 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 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 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

@@ -68,7 +68,7 @@ jobs:
- run: npm ls urchin - run: npm ls urchin
- run: npx which urchin - run: npx which urchin
- run: env - run: env
- run: make TERM=xterm-256color TEST_SUITE="${{ matrix.suite }}" SHELL="${{ matrix.shell }}" URCHIN="$(npx which urchin)" test-${{ matrix.shell }} - run: make TEST_SUITE="${{ matrix.suite }}" SHELL="${{ matrix.shell }}" URCHIN="$(npx which urchin)" test-${{ matrix.shell }}
nvm: nvm:
permissions: permissions:

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> </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` --> <!-- 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 --> <!-- 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 [1]: https://github.com/nvm-sh/nvm.git
[2]: https://github.com/nvm-sh/nvm/blob/v0.40.3/install.sh [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 [4]: https://github.com/nvm-sh/nvm/releases/tag/v0.40.3
[Urchin]: https://git.sdf.org/tlevine/urchin [Urchin]: https://git.sdf.org/tlevine/urchin
[Fish]: https://fishshell.com [Fish]: https://fishshell.com

29
nvm.sh
View File

@@ -978,13 +978,18 @@ nvm_strip_path() {
nvm_err '${NVM_DIR} not set!' nvm_err '${NVM_DIR} not set!'
return 1 return 1
fi 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 { index($0, NVM_DIR) == 1 {
path = substr($0, length(NVM_DIR) + 1) path = substr($0, length(NVM_DIR) + 1)
if (path ~ "^(/versions/[^/]*)?/[^/]*'"${2-}"'.*$") { next } 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 }')"
{ printf "%s%s", sep, $0; sep=RS } END { printf "%s", RT }' # 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() { nvm_change_path() {
@@ -2642,18 +2647,24 @@ nvm_install_source() {
NVM_OS="$(nvm_get_os)" NVM_OS="$(nvm_get_os)"
local make local make
make='make'
local MAKE_CXX 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 case "${NVM_OS}" in
'freebsd' | 'openbsd') 'freebsd' | 'openbsd')
make='gmake' make="gmake${MAKE_SHELL_OVERRIDE-}"
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}" MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;; ;;
'darwin') 'darwin')
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}" MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;; ;;
'aix') 'aix')
make='gmake' make="gmake${MAKE_SHELL_OVERRIDE-}"
;; ;;
esac esac
if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to "$(nvm_clang_version)" 3.5; then 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" NVM_DEFAULT_PACKAGE_FILE="${NVM_DIR}/default-packages"
if [ -f "${NVM_DEFAULT_PACKAGE_FILE}" ]; then if [ -f "${NVM_DEFAULT_PACKAGE_FILE}" ]; then
command awk -v filename="${NVM_DEFAULT_PACKAGE_FILE}" ' command awk -v filename="${NVM_DEFAULT_PACKAGE_FILE}" '
/^[[:space:]]*#/ { next } # Skip lines that begin with # /^[ \t]*#/ { next } # Skip lines that begin with #
/^[[:space:]]*$/ { next } # Skip empty lines /^[ \t]*$/ { next } # Skip empty lines
/[[:space:]]/ && !/^[[:space:]]*#/ { /[ \t]/ && !/^[ \t]*#/ {
print "Only one package per line is allowed in `" filename "`. Please remove any lines with multiple space-separated values." > "/dev/stderr" print "Only one package per line is allowed in `" filename "`. Please remove any lines with multiple space-separated values." > "/dev/stderr"
err = 1 err = 1
exit 1 exit 1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,6 +4,7 @@
die () { echo "$@" ; exit 1; } die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
nvm alias default 0.1 >/dev/null || die "'nvm alias default 0.1' failed" nvm alias default 0.1 >/dev/null || die "'nvm alias default 0.1' failed"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,7 @@
set -ex set -ex
: nvm.sh
\. ../../nvm.sh \. ../../nvm.sh
\. ../common.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}" env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | grep -v TRAVIS_ | sort >> "${BEFORE}"
set +e # TODO: fix set +e # TODO: fix
: nvm.sh
\. ../../nvm.sh \. ../../nvm.sh
set -e set -e

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,12 @@
#!/bin/bash #!/bin/bash
set -x set -x
: nvm.sh
\. ../../nvm.sh \. ../../nvm.sh
die () { echo "$@" ; rm .nvmrc ; exit 1; } cleanup() { rm -f .nvmrc; }
die () { echo "$@" ; cleanup ; exit 1; }
NVM_TEST_VERSION=v0.42 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 # Skip install, we want to test the error message
[ "${EXPECTED}" = "${OUTPUT}" ] || die "expected >${EXPECTED}<, got >${OUTPUT}<" [ "${EXPECTED}" = "${OUTPUT}" ] || die "expected >${EXPECTED}<, got >${OUTPUT}<"
cleanup

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
#set -e #nvm use system returns 127 and No system set message #set -e #nvm use system returns 127 and No system set message

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,6 +12,7 @@ cleanup() {
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts" mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
} }
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
if [ -n "${NVM_COLORS-}" ]; then if [ -n "${NVM_COLORS-}" ]; then
export TEMP_NVM_COLORS=NVM_COLORS export TEMP_NVM_COLORS=NVM_COLORS

View File

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

View File

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

View File

@@ -2,6 +2,7 @@
die () { echo "$@" ; exit 1; } die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
[ "_$(nvm_add_iojs_prefix 1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix 1" did not return "iojs-v1"' [ "_$(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 rm -rf ../../../alias/test
} }
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
OUTPUT="$(nvm_alias 2>&1)" OUTPUT="$(nvm_alias 2>&1)"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,7 @@
TEST_PWD=$(pwd) TEST_PWD=$(pwd)
TEST_DIR="$TEST_PWD/nvm_die_on_prefix_tmp" TEST_DIR="$TEST_PWD/nvm_die_on_prefix_tmp"
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
TEST_VERSION_DIR="${TEST_DIR}/version" TEST_VERSION_DIR="${TEST_DIR}/version"
@@ -11,7 +12,7 @@ cleanup () {
rm -rf "$TEST_DIR" rm -rf "$TEST_DIR"
alias nvm_has='\nvm_has' alias nvm_has='\nvm_has'
alias npm='\npm' alias npm='\npm'
unset -f nvm_has npm unset -f nvm_has npm node
} }
die () { die () {
@@ -60,6 +61,12 @@ npm() {
fi fi
} }
node() {
if [ "_$1" = "_-v" ]; then
echo "v0.0.0"
fi
}
OUTPUT="$(nvm_die_on_prefix 0 foo "$(nvm_version_dir new)" 2>&1)" 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'" [ -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; } die () { echo "$@" ; cleanup ; exit 1; }
: nvm.sh
\. ../../../nvm.sh \. ../../../nvm.sh
set -ex set -ex

View File

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

View File

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

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