[Tests] Fix `nvm_ls_current` fast test
parent
e01060fa2c
commit
e77ed07ccc
|
@ -19,7 +19,8 @@ fi
|
||||||
|
|
||||||
rm -rf "$TEST_DIR"
|
rm -rf "$TEST_DIR"
|
||||||
mkdir "$TEST_DIR"
|
mkdir "$TEST_DIR"
|
||||||
ln -s "$(command which which)" "$TEST_DIR/which"
|
# Ensure that the system version of which is used, not node_modules/.bin/which
|
||||||
|
ln -s "$(PATH=$(echo $PATH | tr ":" "\n" | grep -v "node_modules/.bin" | tr "\n" ":") command which which)" "$TEST_DIR/which"
|
||||||
ln -s "$(command which dirname)" "$TEST_DIR/dirname"
|
ln -s "$(command which dirname)" "$TEST_DIR/dirname"
|
||||||
ln -s "$(command which printf)" "$TEST_DIR/printf"
|
ln -s "$(command which printf)" "$TEST_DIR/printf"
|
||||||
|
|
||||||
|
@ -27,12 +28,12 @@ ln -s "$(command which printf)" "$TEST_DIR/printf"
|
||||||
[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'
|
[ "@$(PATH="$TEST_DIR" nvm_ls_current 2> /dev/stdout 1> /dev/null)@" = "@@" ] || die 'when node not installed, nvm_ls_current returned error output'
|
||||||
|
|
||||||
echo "#!/bin/bash" > "$TEST_DIR/node"
|
echo "#!/bin/bash" > "$TEST_DIR/node"
|
||||||
echo "echo 'VERSION FOO!'" > "$TEST_DIR/node"
|
echo "echo 'VERSION FOO!'" >> "$TEST_DIR/node"
|
||||||
chmod a+x "$TEST_DIR/node"
|
chmod a+x "$TEST_DIR/node"
|
||||||
|
|
||||||
[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'
|
[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'
|
||||||
|
|
||||||
alias node='node --harmony'
|
alias node='node --harmony'
|
||||||
[ "$(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'
|
[ "$(PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
Loading…
Reference in New Issue