nvm_install_binary_nosource
This file
Path
test/fast/Unit tests/nvm_install_binary_nosource
34 lines · 1.1 KiB
Last changed by
[Tests] fix 4 test failuresJordan Harbandbefore adoption3e37cfb
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–11why, one step back1#!/bin/sh23cleanup () {4 nvm cache clear5 nvm deactivate6 rm -rf ${NVM_DIR}/v*7 nvm unalias default8}910die () { echo "$@" ; cleanup; exit 1;}11[Tests] set `$_` before sourcing `nvm.sh` in fast testsJordan Harbandbefore adoptionc451e7a
line 12why, one step back12: nvm.sh[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 13–25why, one step back13\. ../../../nvm.sh1415nvm_binary_available() {16 return 117}1819# Unit test to check if the function errors out when the flag is set20OUTPUT="$(nvm_install_binary node std 8.0.0 1 2>&1)"21EXPECTED_OUTPUT='Binary download failed. Download from source aborted.'22if [ "${OUTPUT#*$EXPECTED_OUTPUT}" = "${OUTPUT}" ]; then23 die "No source binary flag is active and should have returned >${EXPECTED_OUTPUT}<. Instead it returned >${OUTPUT}<"24fi25[Tests] fix 4 test failuresJordan Harbandbefore adoption3e37cfb
line 26why, one step back26nvm_install_binary node std 8.0.0 1 >/dev/null 2>&1; EXIT_CODE=$?[Fix] `nvm_install_binary`: return failure when binary download fails with `-b`Jordan Harbandbefore adoption05d7847
lines 27–28why, one step back27[ "${EXIT_CODE}" = "2" ] || die "Expected exit code 2 when nosource=1 and binary fails, got ${EXIT_CODE}"28[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680
lines 29–34why, one step back29# Unit test to check if the function errors out when the flag is set30OUTPUT="$(nvm_install_binary node std 8.0.0 0 2>&1)"31EXPECTED_OUTPUT='Binary download failed. Download from source aborted.'32if [ "${OUTPUT#*$EXPECTED_OUTPUT}" != "${OUTPUT}" ]; then33 die "No source binary flag is not active and should have downloaded from source. Instead it returned >${OUTPUT}<"34fi