Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tests] Ensure color codes are stripped in alias tests.
- Loading branch information
Showing
11 changed files
with
111 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 10 additions & 9 deletions
19
test/fast/Aliases/Running "nvm alias" lists implicit aliases when they do not exist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
#!/bin/sh | ||
|
||
. ../../../nvm.sh | ||
. ../../common.sh | ||
|
||
die () { echo $@ ; exit 1; } | ||
|
||
NVM_ALIAS_OUTPUT=$(nvm alias) | ||
NVM_ALIAS_OUTPUT=$(nvm alias | strip_colors) | ||
|
||
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)" | ||
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e "^stable -> $EXPECTED_STABLE (-> $STABLE_VERSION) (default)$" \ | ||
|| die "nvm alias did not contain the default local stable node version" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F "stable -> $EXPECTED_STABLE (-> $STABLE_VERSION) (default)" \ | ||
|| die "nvm alias did not contain the default local stable node version; got '$NVM_ALIAS_OUTPUT'" | ||
|
||
echo "$NVM_ALIAS_OUTPUT" | \grep -e "^node -> stable (-> $STABLE_VERSION) (default)$" \ | ||
|| die "nvm alias did not contain the default local stable node version under 'node'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F "node -> stable (-> $STABLE_VERSION) (default)" \ | ||
|| die "nvm alias did not contain the default local stable node version under 'node'; got '$NVM_ALIAS_OUTPUT'" | ||
|
||
EXPECTED_UNSTABLE="$(nvm_print_implicit_alias local unstable)" | ||
UNSTABLE_VERSION="$(nvm_version "$EXPECTED_UNSTABLE")" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e "^unstable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION) (default)$" \ | ||
|| die "nvm alias did not contain the default local unstable node version" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F "unstable -> $EXPECTED_UNSTABLE (-> $UNSTABLE_VERSION) (default)" \ | ||
|| die "nvm alias did not contain the default local unstable node version; got '$NVM_ALIAS_OUTPUT'" | ||
|
||
EXPECTED_IOJS="$(nvm_print_implicit_alias local iojs)" | ||
IOJS_VERSION="$(nvm_version "$EXPECTED_IOJS")" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e "^iojs -> $EXPECTED_IOJS (-> $IOJS_VERSION) (default)$" \ | ||
|| die "nvm alias did not contain the default local iojs version" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F "iojs -> $EXPECTED_IOJS (-> $IOJS_VERSION) (default)" \ | ||
|| die "nvm alias did not contain the default local iojs version; got '$NVM_ALIAS_OUTPUT'" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 42 additions & 42 deletions
84
test/fast/Aliases/Running "nvm alias" should list all aliases.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
#!/bin/sh | ||
|
||
. ../../../nvm.sh | ||
. ../../common.sh | ||
|
||
die () { echo $@ ; exit 1; } | ||
|
||
NVM_ALIAS_OUTPUT=$(nvm alias) | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-1 -> 0.0.1 (-> v0.0.1)$' \ | ||
|| die "did not find test-stable-1 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-2 -> 0.0.2 (-> v0.0.2)$' \ | ||
|| die "did not find test-stable-2 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-3 -> 0.0.3 (-> v0.0.3)$' \ | ||
|| die "did not find test-stable-3 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-4 -> 0.0.4 (-> v0.0.4)$' \ | ||
|| die "did not find test-stable-4 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-5 -> 0.0.5 (-> v0.0.5)$' \ | ||
|| die "did not find test-stable-5 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-6 -> 0.0.6 (-> v0.0.6)$' \ | ||
|| die "did not find test-stable-6 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-7 -> 0.0.7 (-> v0.0.7)$' \ | ||
|| die "did not find test-stable-7 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-8 -> 0.0.8 (-> v0.0.8)$' \ | ||
|| die "did not find test-stable-8 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-9 -> 0.0.9 (-> v0.0.9)$' \ | ||
|| die "did not find test-stable-9 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-10 -> 0.0.10 (-> v0.0.10)$' \ | ||
|| die "did not find test-stable-10 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-1 -> 0.1.1 (-> v0.1.1)$' \ | ||
|| die "did not find test-unstable-1 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-2 -> 0.1.2 (-> v0.1.2)$' \ | ||
|| die "did not find test-unstable-2 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-3 -> 0.1.3 (-> v0.1.3)$' \ | ||
|| die "did not find test-unstable-3 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-4 -> 0.1.4 (-> v0.1.4)$' \ | ||
|| die "did not find test-unstable-4 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-5 -> 0.1.5 (-> v0.1.5)$' \ | ||
|| die "did not find test-unstable-5 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-6 -> 0.1.6 (-> v0.1.6)$' \ | ||
|| die "did not find test-unstable-6 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-7 -> 0.1.7 (-> v0.1.7)$' \ | ||
|| die "did not find test-unstable-7 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-8 -> 0.1.8 (-> v0.1.8)$' \ | ||
|| die "did not find test-unstable-8 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-9 -> 0.1.9 (-> v0.1.9)$' \ | ||
|| die "did not find test-unstable-9 alias" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-10 -> 0.1.10 (-> v0.1.10)$' \ | ||
|| die "did not find test-unstable-10 alias" | ||
|
||
NVM_ALIAS_OUTPUT="$(nvm alias | strip_colors)" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-1 -> 0.0.1 (-> v0.0.1)' \ | ||
|| die "did not find test-stable-1 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-2 -> 0.0.2 (-> v0.0.2)' \ | ||
|| die "did not find test-stable-2 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-3 -> 0.0.3 (-> v0.0.3)' \ | ||
|| die "did not find test-stable-3 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-4 -> 0.0.4 (-> v0.0.4)' \ | ||
|| die "did not find test-stable-4 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-5 -> 0.0.5 (-> v0.0.5)' \ | ||
|| die "did not find test-stable-5 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-6 -> 0.0.6 (-> v0.0.6)' \ | ||
|| die "did not find test-stable-6 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-7 -> 0.0.7 (-> v0.0.7)' \ | ||
|| die "did not find test-stable-7 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-8 -> 0.0.8 (-> v0.0.8)' \ | ||
|| die "did not find test-stable-8 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-9 -> 0.0.9 (-> v0.0.9)' \ | ||
|| die "did not find test-stable-9 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-stable-10 -> 0.0.10 (-> v0.0.10)' \ | ||
|| die "did not find test-stable-10 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-1 -> 0.1.1 (-> v0.1.1)' \ | ||
|| die "did not find test-unstable-1 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-2 -> 0.1.2 (-> v0.1.2)' \ | ||
|| die "did not find test-unstable-2 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-3 -> 0.1.3 (-> v0.1.3)' \ | ||
|| die "did not find test-unstable-3 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-4 -> 0.1.4 (-> v0.1.4)' \ | ||
|| die "did not find test-unstable-4 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-5 -> 0.1.5 (-> v0.1.5)' \ | ||
|| die "did not find test-unstable-5 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-6 -> 0.1.6 (-> v0.1.6)' \ | ||
|| die "did not find test-unstable-6 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-7 -> 0.1.7 (-> v0.1.7)' \ | ||
|| die "did not find test-unstable-7 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-8 -> 0.1.8 (-> v0.1.8)' \ | ||
|| die "did not find test-unstable-8 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-9 -> 0.1.9 (-> v0.1.9)' \ | ||
|| die "did not find test-unstable-9 alias; got '$NVM_ALIAS_OUTPUT'" | ||
echo "$NVM_ALIAS_OUTPUT" | \grep -F 'test-unstable-10 -> 0.1.10 (-> v0.1.10)' \ | ||
|| die "did not find test-unstable-10 alias; got '$NVM_ALIAS_OUTPUT'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
#!/bin/sh | ||
. ../../../common.sh | ||
|
||
die () { echo $@ ; exit 1; } | ||
|
||
. ../../../../nvm.sh | ||
|
||
ALIAS="$(nvm_resolve_alias loopback)" | ||
ALIAS="$(nvm_resolve_alias loopback | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias loopback was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias loopback)" | ||
OUTPUT="$(nvm alias loopback | strip_colors)" | ||
EXPECTED_OUTPUT="loopback -> loopback (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias loopback was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias one)" | ||
ALIAS="$(nvm_resolve_alias one | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias one was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias one)" | ||
OUTPUT="$(nvm alias one | strip_colors)" | ||
EXPECTED_OUTPUT="one -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias one was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias two)" | ||
ALIAS="$(nvm_resolve_alias two | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias two was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias two)" | ||
OUTPUT="$(nvm alias two | strip_colors)" | ||
EXPECTED_OUTPUT="two -> three (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias two was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias three)" | ||
ALIAS="$(nvm_resolve_alias three | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias three was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias three)" | ||
OUTPUT="$(nvm alias three | strip_colors)" | ||
EXPECTED_OUTPUT="three -> one (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias three was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias four)" | ||
ALIAS="$(nvm_resolve_alias four | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias four was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias four)" | ||
OUTPUT="$(nvm alias four | strip_colors)" | ||
EXPECTED_OUTPUT="four -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias four was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
#!/bin/sh | ||
. ../../../common.sh | ||
|
||
die () { echo $@ ; exit 1; } | ||
|
||
. ../../../../nvm.sh | ||
|
||
ALIAS="$(nvm_resolve_local_alias loopback)" | ||
ALIAS="$(nvm_resolve_local_alias loopback | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias loopback was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias loopback)" | ||
OUTPUT="$(nvm alias loopback | strip_colors)" | ||
EXPECTED_OUTPUT="loopback -> loopback (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias loopback was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_local_alias one)" | ||
ALIAS="$(nvm_resolve_local_alias one | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias one was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias one)" | ||
OUTPUT="$(nvm alias one | strip_colors)" | ||
EXPECTED_OUTPUT="one -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias one was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_local_alias two)" | ||
ALIAS="$(nvm_resolve_local_alias two | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias two was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias two)" | ||
OUTPUT="$(nvm alias two | strip_colors)" | ||
EXPECTED_OUTPUT="two -> three (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias two was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_local_alias three)" | ||
ALIAS="$(nvm_resolve_local_alias three | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias three was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias three)" | ||
OUTPUT="$(nvm alias three | strip_colors)" | ||
EXPECTED_OUTPUT="three -> one (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias three was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_local_alias four)" | ||
ALIAS="$(nvm_resolve_local_alias four | strip_colors)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_local_alias four was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias four)" | ||
OUTPUT="$(nvm alias four | strip_colors)" | ||
EXPECTED_OUTPUT="four -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias four was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters