Skip to content
Myr

[Tests] Fix `nvm_ls_current` fast test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alex Aubuchon · committed by Jordan Harband · parent e01060f · Browse files · 1 file+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−4 removed

  • tests:+5 added−4 removed

1 file+5 added−4 removed

modified:test/fast/Unit tests/nvm_ls_current+5 added-4 removed
17 unmodified lines
18[ "_$(nvm deactivate > /dev/null 2>&1 ; nvm_ls_current)" = "_$EXPECTED_SYSTEM_NODE" ] || die "when deactivated, did not return $EXPECTED_SYSTEM_NODE"1920rm -rf "$TEST_DIR"21mkdir "$TEST_DIR"22ln -s "$(command which which)" "$TEST_DIR/which"22# Ensure that the system version of which is used, not node_modules/.bin/which23ln -s "$(PATH=$(echo $PATH | tr ":" "\n" | grep -v "node_modules/.bin" | tr "\n" ":") command which which)" "$TEST_DIR/which"24ln -s "$(command which dirname)" "$TEST_DIR/dirname"25ln -s "$(command which printf)" "$TEST_DIR/printf"2627[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "none" ] || die 'when node not installed, nvm_ls_current did not return "none"'28[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'2930echo "#!/bin/bash" > "$TEST_DIR/node"30echo "echo 'VERSION FOO!'" > "$TEST_DIR/node"31echo "echo 'VERSION FOO!'" >> "$TEST_DIR/node"32chmod a+x "$TEST_DIR/node"3333[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'34[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'3536alias node='node --harmony'36[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'37[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'3839cleanup