Skip to content

Commit d15c0dc

Browse files
committed
update
1 parent c0d2d1c commit d15c0dc

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ install:
2121
- if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint dockerfile_lint; fi
2222
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
2323
script:
24-
- if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
24+
- >
25+
if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then
26+
set -x
27+
if [ "${TEST_SUITE}" = 'installation_iojs' ]; then
28+
travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL
29+
ret_val=$?
30+
else
31+
make --debug=v TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL
32+
ret_val=$?
33+
fi
34+
set +x
35+
exit $ret_val
36+
fi
2537
before_cache:
2638
- if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi
2739
env:

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ nvm_profile_is_bash_or_zsh() {
4343
#
4444
nvm_source() {
4545
local NVM_GITHUB_REPO
46-
NVM_GITHUB_REPO="${NVM_INSTALL_GITHUB_REPO:-nvm-sh}"
46+
NVM_GITHUB_REPO="${NVM_INSTALL_GITHUB_REPO:-nvm-sh/nvm}"
4747
local NVM_VERSION
4848
NVM_VERSION="${NVM_INSTALL_VERSION:-$(nvm_latest_version)}"
4949
local NVM_METHOD

test/install_script/nvm_install_with_aliased_dot

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

3-
setup () {
3+
setup() {
4+
# Needed to avoid to checkout the repo to the latest nvm version, loosing the commits of the current PR
5+
unset NVM_DIR
46
shopt -s expand_aliases
57
alias .=':'
68
NVM_ENV=testing \. ../../install.sh > /dev/null
@@ -12,7 +14,7 @@ cleanup () {
1214
shopt -u expand_aliases
1315
}
1416

15-
die () { echo "$@"; exit 1; }
17+
die () { echo "$@"; cleanup; exit 1; }
1618

1719
setup
1820

test/install_script/nvm_install_with_node_version

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

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

5+
# Needed to avoid to checkout the repo to the latest nvm version, loosing the commits of the current PR
6+
unset NVM_DIR
57
NODE_VERSION=8 \. ../../install.sh
68

79
# nvm installed node 8
810
nvm ls 8 > /dev/null 2>&1 || die "nvm didn't install node 8"
11+

test/install_script/nvm_other

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
echo 'I want to fail !!!'
4+
exit 1

test/install_script/nvm_source

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@ cleanup () {
88
}
99
die () { echo "$@" ; cleanup ; exit 1; }
1010

11+
unset NVM_SOURCE
12+
1113
NVM_ENV=testing \. ../../install.sh
1214

1315
# nvm_source with no parameter returns the git endpoint
14-
echo $(nvm_source) | grep "https://github.com/nvm-sh/nvm.git$" > /dev/null || die "nvm_source without arguments should return the location of the git repo"
1516
[ "$(nvm_source)" = "https://github.com/nvm-sh/nvm.git" ] || die "nvm_source without arguments should return the location of the git repo"
16-
NVM_GITHUB_REPO="other-user/other-nvm" echo $(nvm_source) | grep "https://github.com/other-user/other-nvm.git$" > /dev/null || die "nvm_source without arguments should return the location of the git repo"
17+
NVM_INSTALL_GITHUB_REPO="other-user/other-nvm" nvm_source | grep "https://github.com/other-user/other-nvm.git$" > /dev/null || die "NVM_INSTALL_GITHUB_REPO=... nvm_source without arguments should return the location of the given git repo"
1718

1819
# nvm_source with git parameter returns the location of the nvm repo
19-
echo $(nvm_source "git") | grep "https://github.com/nvm-sh/nvm.git$" > /dev/null || die "nvm_source without arguments should return the location of the git repo"
20-
NVM_GITHUB_REPO="other-user/other-nvm" echo $(nvm_source "git") | grep "https://github.com/other-user/other-nvm.git$" > /dev/null || die "nvm_source without arguments should return the location of the git repo"
20+
[ "$(nvm_source "git")" = "https://github.com/nvm-sh/nvm.git" ] || die "nvm_source \"git\" should return the location of the git repo"
21+
NVM_INSTALL_GITHUB_REPO="other-user/other-nvm" nvm_source "git" | grep "https://github.com/other-user/other-nvm.git$" > /dev/null || die "NVM_INSTALL_GITHUB_REPO=... nvm_source \"git\" should return the location of the given git repo"
2122

2223
# nvm_source with script parameter returns the location of nvm.sh
23-
echo $(nvm_source "script") | grep "https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm.sh$" > /dev/null || die "nvm_source \"script\" should return the location of nvm.sh"
24-
NVM_GITHUB_REPO="other-user/other-nvm" NVM_INSTALL_VERSION="v0.37.2" echo $(nvm_source "script") | grep "https://raw.githubusercontent.com/other-user/other-nvm/v0.37.2/nvm.sh$" > /dev/null || die "nvm_source \"script\" should return the location of nvm.sh"
24+
[ "$(nvm_source "script")" = "https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm.sh" ] || die "nvm_source \"script\" should return the location of nvm.sh"
25+
NVM_INSTALL_GITHUB_REPO="other-user/other-nvm" NVM_INSTALL_VERSION="v0.37.0" nvm_source "script" | grep "https://raw.githubusercontent.com/other-user/other-nvm/v0.37.0/nvm.sh$" > /dev/null || die "NVM_INSTALL_GITHUB_REPO=... NVM_INSTALL_VERSION=... nvm_source \"script\" should return the location of nvm.sh"
2526

2627
# nvm_source with script-nvm-exec parameter returns the location of nvm-exec
27-
echo $(nvm_source "script-nvm-exec") | grep "https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm-exec$" > /dev/null || die "nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
28-
NVM_GITHUB_REPO="other-user/other-nvm" NVM_INSTALL_VERSION="v0.37.2" echo $(nvm_source "script-nvm-exec") | grep "https://raw.githubusercontent.com/other-user/other-nvm/v0.37.2/nvm-exec$" > /dev/null || die "nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
28+
[ "$(nvm_source "script-nvm-exec")" = "https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm-exec" ] || die "nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
29+
NVM_INSTALL_GITHUB_REPO="other-user/other-nvm" NVM_INSTALL_VERSION="v0.37.0" nvm_source "script-nvm-exec" | grep "https://raw.githubusercontent.com/other-user/other-nvm/v0.37.0/nvm-exec$" > /dev/null || die "NVM_INSTALL_GITHUB_REPO=... NVM_INSTALL_VERSION=... nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
2930

3031
# nvm_source with any other parameter errors out and exits
3132
nvm_source "anything" 2> /dev/null && die "nvm_source with invalid parameter should exit"
@@ -44,3 +45,4 @@ out=$(nvm_source "anything")
4445
[ "_$out" = "_my_location" ] || die "nvm_source script should have returned \$NVM_SOURCE. Got \"$out\""
4546

4647
cleanup
48+

0 commit comments

Comments
 (0)