Skip to content

Commit d08c588

Browse files
committed
Use nodenv from npm in tests
1 parent 11d4c4e commit d08c588

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/test_helper.bash

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# shellcheck shell=bash
22

3+
unset NODENV_VERSION
4+
35
EXAMPLE_PACKAGE_DIR="$BATS_TMPDIR/example_package"
4-
TEST_BASENAME="$(basename "$BATS_TEST_DIRNAME")"
5-
# TODO: Should this just be $(dirname ...) ?
6-
PLUGIN_ROOT="${BATS_TEST_DIRNAME%${TEST_BASENAME}}"
76

87
setup() {
98
export NODENV_ROOT="$BATS_TMPDIR/nodenv_root"
10-
unset NODENV_VERSION # don't leak version from test runner
11-
mkdir -p "$NODENV_ROOT/plugins"
12-
ln -s "$PLUGIN_ROOT" "$NODENV_ROOT/plugins/package-json-engine"
9+
10+
PATH="$(npm bin):/usr/bin:/bin:/usr/sbin:/sbin"
11+
PATH="${BATS_TEST_DIRNAME}/../bin:$PATH"
12+
export PATH
13+
14+
eval "$(nodenv init -)"
1315
}
1416

1517
teardown() {

0 commit comments

Comments
 (0)