From 5970a06b197085a7104121f0d78beedd33313d0e Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 18 Apr 2016 22:08:40 +0100 Subject: [PATCH] Add slow test to check nvm uninstall with file permission error --- ...h incorrect file permissions fails nicely" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 "test/slow/nvm uninstall/Running \"nvm uninstall\" with incorrect file permissions fails nicely" diff --git "a/test/slow/nvm uninstall/Running \"nvm uninstall\" with incorrect file permissions fails nicely" "b/test/slow/nvm uninstall/Running \"nvm uninstall\" with incorrect file permissions fails nicely" new file mode 100755 index 0000000..eff2bc4 --- /dev/null +++ "b/test/slow/nvm uninstall/Running \"nvm uninstall\" with incorrect file permissions fails nicely" @@ -0,0 +1,30 @@ +#!/bin/sh + +die () { echo $@ ; exit 1; } + +# Source nvm +. ../../../nvm.sh + +# Version to install/uninstall +NVM_TEST_VERSION=5.10.1 + +# Make sure it's not already here +[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION + +# Install it +nvm install $NVM_TEST_VERSION + +# Make sure it installed +nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node" + +# Install global module as root +npm_path=$(which npm) +sudo "$npm_path" install jspm -g + +# Switch to another version so we can uninstall +nvm use 0.12.7 + +# Attempt to uninstall it +RETURN_MESSAGE="$(nvm uninstall $NVM_TEST_VERSION 2>&1)" +CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder" +test "${RETURN_MESSAGE#*$CHECK_FOR}" != "$RETURN_MESSAGE" || die "Failed to show error message"