Skip to content
Myr

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 file

Take 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 back
1#!/bin/sh
23die () { 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 back
9: nvm.sh

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 10–14why, one step back
10\. ../../../nvm.sh
1112\. ../../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 back
15 try nvm_process_nvmrc $f/.nvmrc

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 16–18why, one step back
16
17 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 back
19 [ "${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 back
20

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

line 21why, one step back
21 [ "${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 back
22done
2324for 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 back
25 try nvm_process_nvmrc $f/.nvmrc
26 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 back
28
29 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 back
31 [ "${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 back
32
33 [ "${STDERR}" = "${EXPECTED}" ] || die "$(basename "${f}"): expected STDERR of \`${EXPECTED}\` but got \`${STDERR}\`"34done