nvm_process_nvmrc
This file
Path
test/fast/Unit tests/nvm_process_nvmrc
34 lines · 1.1 KiB
Last changed by
[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
History of this fileTake it
The walk stopped after 200 commits: lines older than 5c12680 point at it.
[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 1–8why, one step back1#!/bin/sh23die () { echo "$@" ; cleanup ; exit 1; }45cleanup() {6 echo 'cleaned up'7}8[Tests] set `$_` before sourcing `nvm.sh` in fast testsJordan Harbandbefore adoptionc451e7a
line 9why, one step back9: nvm.sh[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 10–14why, one step back10\. ../../../nvm.sh1112\. ../../common.sh1314for f in ../../../test/fixtures/nvmrc/test/fixtures/valid/*; do[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
line 15why, one step back15 try nvm_process_nvmrc $f/.nvmrc[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 16–18why, one step back1617 EXPECTED="$(nvm_json_extract node < "${f}/expected.json" | tr -d '"')"18[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
line 19why, one step back19 [ "${CAPTURED_EXIT_CODE}" = "0" ] || die "$(basename "${f}"): expected exit code of 0 but got ${CAPTURED_EXIT_CODE}"[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
line 20why, one step back20[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
line 21why, one step back21 [ "${CAPTURED_STDOUT}" = "${EXPECTED}" ] || die "$(basename "${f}"): expected STDOUT of \`${EXPECTED}\` but got \`${CAPTURED_STDOUT}\`"[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 22–24why, one step back22done2324for f in ../../../test/fixtures/nvmrc/test/fixtures/invalid/*; do[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
lines 25–27why, one step back25 try nvm_process_nvmrc $f/.nvmrc26 try_err nvm_process_nvmrc $f/.nvmrc27 STDERR="$(echo "$CAPTURED_STDERR" | awk '{if(NR > 8) print $0}' | strip_colors)"[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 28–30why, one step back2829 EXPECTED="$(nvm_json_extract < "${f}/expected.json" | tr -d '"')"30[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6
line 31why, one step back31 [ "${CAPTURED_EXIT_CODE}" != "0" ] || die "$(basename "${f}"): expected exit code of 'not 0' but got ${CAPTURED_EXIT_CODE}"[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 32–34why, one step back3233 [ "${STDERR}" = "${EXPECTED}" ] || die "$(basename "${f}"): expected STDERR of \`${EXPECTED}\` but got \`${STDERR}\`"34done