Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename .github/ISSUE_TEMPLATE.md to .github/ISSUE_TEMPLATE/ISSUE_TEMP… #3454

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
20 changes: 16 additions & 4 deletions test/fast/Unit tests/nvm ls-remote
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ cleanup() {
export NVM_COLORS=TEMP_NVM_COLORS
fi
unset TEMP_NVM_COLORS
rm -rf "${NVM_DIR}/alias/lts"
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
}

\. ../../../nvm.sh
Expand All @@ -16,12 +18,24 @@ if [ -n "${NVM_COLORS-}" ]; then
unset NVM_COLORS
fi

MOCKS_DIR="../Unit tests/mocks"

LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"

STAR="$(cat "${MOCKS_DIR}/lts-star.txt")"

mv "${NVM_DIR}/alias/lts" "${NVM_DIR}/alias/lts-backup" ||:
mkdir -p "${NVM_DIR}/alias/lts"

echo "${STAR}" > "${NVM_DIR}/alias/lts/\*"
printf '%s\n' "$(cat "${LTS_NAMES_PATH}" | tail -n +1)" | while IFS= read -r LTS; do
cp "${NVM_DIR}/alias/lts-backup/${LTS}" "${NVM_DIR}/alias/lts/"
done

nvm deactivate 2>/dev/null || die 'unable to deactivate'

\. ../../common.sh

MOCKS_DIR="${PWD}/mocks"

nvm_download() {
if [ "$*" = "-L -s $(nvm_get_mirror node std)/index.tab -o -" ]; then
cat "${MOCKS_DIR}/nodejs.org-dist-index.tab"
Expand All @@ -40,8 +54,6 @@ OUTPUT="$(nvm ls-remote "lts/*" | sed 's/[ \t]*$//')"
EXPECTED_OUTPUT="$(cat "${EXPECTED_OUTPUT_PATH}" | sed 's/[ \t]*$//' )"
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] || die "nvm ls-remote lts/* did not output expected sorted versions; got >${OUTPUT}< expected >${EXPECTED_OUTPUT}<"

MOCKS_DIR="${PWD}/mocks"
LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"
LTS_LIST="$(cat "${LTS_NAMES_PATH}" | tail -n +2)"

INDEX=1
Expand Down
18 changes: 14 additions & 4 deletions test/fast/Unit tests/nvm_alias LTS-N
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ die () { echo "$@" ; cleanup ; exit 1; }

cleanup() {
unset -f nvm_download
rm -rf "${NVM_DIR}/alias/lts"
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
}

\. ../../../nvm.sh

set -ex

MOCKS_DIR="${PWD}/mocks"

LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"
LTS_LIST="$(cat "${LTS_NAMES_PATH}" | tail -n +2)"

mv "${NVM_DIR}/alias/lts" "${NVM_DIR}/alias/lts-backup" ||:
mkdir -p "${NVM_DIR}/alias/lts"

for LTS in $LTS_LIST; do
cp "${NVM_DIR}/alias/lts-backup/${LTS}" "${NVM_DIR}/alias/lts/"
done

set -ex

# sample output at the time the test was written
TAB_PATH="${MOCKS_DIR}/nodejs.org-dist-index.tab"
nvm_download() {
Expand All @@ -21,8 +33,6 @@ nvm_download() {

nvm_ls_remote >/dev/null || die "nvm_ls_remote_failed?!"

LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"

N=0
while IFS= read -r LTS; do
if [ $N -gt 0 ]; then
Expand Down
29 changes: 21 additions & 8 deletions test/fast/Unit tests/nvm_normalize_lts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,44 @@

cleanup() {
unset nvm_get_os
rm -rf "${NVM_DIR}/alias/lts"
mv "${NVM_DIR}/alias/lts-backup" "${NVM_DIR}/alias/lts"
}

die () { cleanup; echo "$@" ; exit 1; }

\. ../../../nvm.sh

MOCKS_DIR="../Unit tests/mocks"

LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"

STAR="$(cat "${MOCKS_DIR}/lts-star.txt")"

mv "${NVM_DIR}/alias/lts" "${NVM_DIR}/alias/lts-backup" ||:
mkdir -p "${NVM_DIR}/alias/lts"

echo "${STAR}" > "${NVM_DIR}/alias/lts/\*"
printf '%s\n' "$(cat "${LTS_NAMES_PATH}" | tail -n +1)" | while IFS= read -r LTS; do
cp "${NVM_DIR}/alias/lts-backup/${LTS}" "${NVM_DIR}/alias/lts/"
done

ACTUAL="$(nvm_normalize_lts "foo")"
EXPECTED='foo'
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
[ "${ACTUAL}" = "${EXPECTED}" ] || die "foo: expected >${EXPECTED}<, got >${ACTUAL}<"

ACTUAL="$(nvm_normalize_lts "lts/*")"
EXPECTED='lts/*'
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
[ "${ACTUAL}" = "${EXPECTED}" ] || die "*: expected >${EXPECTED}<, got >${ACTUAL}<"

if ACTUAL="$(nvm_normalize_lts lts/ARGON)"; then
die "expected failure, got >${ACTUAL}<"
die "ARGON: expected failure, got >${ACTUAL}<"
fi

MOCKS_DIR="../Unit tests/mocks"
STAR="$(cat "$MOCKS_DIR/lts-star.txt")"

ACTUAL="$(nvm_normalize_lts "${STAR}")"
EXPECTED="${STAR}"
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
[ "${ACTUAL}" = "${EXPECTED}" ] || die "${STAR}: expected >${EXPECTED}<, got >${ACTUAL}<"

LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"
LTS_LIST="$(cat "${LTS_NAMES_PATH}" | tail -n +2)"

INDEX=1
Expand All @@ -39,3 +51,4 @@ printf '%s\n' "${LTS_LIST}" | while IFS= read -r LTS; do

INDEX=$(($INDEX + 1))
done

Loading