![gal@spitfire.co.il](/assets/img/avatar_default.png)
![GitHub](/assets/img/avatar_default.png)
166 changed files with 4361 additions and 2868 deletions
@ -0,0 +1,269 @@
@@ -0,0 +1,269 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash aliasing versions: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
((fnm ls) | grep 8.11.3 || (echo "Expected output to contain 8.11.3" && exit 1)) | grep oldie || (echo "Expected output to contain oldie" && exit 1) |
||||
((fnm ls) | grep 6.11.3 || (echo "Expected output to contain 6.11.3" && exit 1)) | grep older || (echo "Expected output to contain older" && exit 1) |
||||
fnm use older |
||||
if [ "$(node --version)" != "v6.11.3" ]; then |
||||
echo "Expected node version to be v6.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi |
||||
fnm use oldie |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi |
||||
fnm use default |
||||
if [ "$(node --version)" != "v6.11.3" ]; then |
||||
echo "Expected node version to be v6.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash allows to install an lts if version missing: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm use --install-if-missing |
||||
(fnm ls) | grep lts-latest || (echo "Expected output to contain lts-latest" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Bash can alias the system node: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm alias system my_system |
||||
(fnm ls) | grep my_system || (echo "Expected output to contain my_system" && exit 1) |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
(fnm ls) | grep my_system2 || (echo "Expected output to contain my_system2" && exit 1) |
||||
(fnm use my_system) | grep 'Bypassing fnm' || (echo "Expected output to contain 'Bypassing fnm'" && exit 1) |
||||
fnm unalias my_system |
||||
(fnm use my_system 2>&1) | grep 'Requested version my_system is not currently installed' || (echo "Expected output to contain 'Requested version my_system is not currently installed'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Bash errors when alias is not found: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
(fnm use 2>&1) | grep 'Requested version lts-latest is not' || (echo "Expected output to contain 'Requested version lts-latest is not'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Bash unalias a version: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 11.10.0 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11.3 version8 |
||||
(fnm ls) | grep version8 || (echo "Expected output to contain version8" && exit 1) |
||||
fnm unalias version8 |
||||
(fnm use version8 2>&1) | grep 'Requested version version8 is not currently installed' || (echo "Expected output to contain 'Requested version version8 is not currently installed'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Bash unalias errors if alias not found: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
(fnm unalias lts 2>&1) | grep 'Requested alias lts not found' || (echo "Expected output to contain 'Requested alias lts not found'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Fish aliasing versions: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
begin; begin; fnm ls; end | grep 8.11.3; or echo "Expected output to contain 8.11.3" && exit 1; end | grep oldie; or echo "Expected output to contain oldie" && exit 1 |
||||
begin; begin; fnm ls; end | grep 6.11.3; or echo "Expected output to contain 6.11.3" && exit 1; end | grep older; or echo "Expected output to contain older" && exit 1 |
||||
fnm use older |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v6.11.3" |
||||
echo "Expected node version to be v6.11.3. Got $____test____" |
||||
exit 1 |
||||
end |
||||
fnm use oldie |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected node version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end |
||||
fnm use default |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v6.11.3" |
||||
echo "Expected node version to be v6.11.3. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish allows to install an lts if version missing: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm use --install-if-missing |
||||
begin; fnm ls; end | grep lts-latest; or echo "Expected output to contain lts-latest" && exit 1" |
||||
`; |
||||
|
||||
exports[`Fish can alias the system node: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm alias system my_system |
||||
begin; fnm ls; end | grep my_system; or echo "Expected output to contain my_system" && exit 1 |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
begin; fnm ls; end | grep my_system2; or echo "Expected output to contain my_system2" && exit 1 |
||||
begin; fnm use my_system; end | grep 'Bypassing fnm'; or echo "Expected output to contain 'Bypassing fnm'" && exit 1 |
||||
fnm unalias my_system |
||||
begin; fnm use my_system 2>&1; end | grep 'Requested version my_system is not currently installed'; or echo "Expected output to contain 'Requested version my_system is not currently installed'" && exit 1" |
||||
`; |
||||
|
||||
exports[`Fish errors when alias is not found: Fish 1`] = ` |
||||
"fnm env --log-level=error | source |
||||
begin; fnm use 2>&1; end | grep 'Requested version lts-latest is not'; or echo "Expected output to contain 'Requested version lts-latest is not'" && exit 1" |
||||
`; |
||||
|
||||
exports[`Fish unalias a version: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install 11.10.0 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11.3 version8 |
||||
begin; fnm ls; end | grep version8; or echo "Expected output to contain version8" && exit 1 |
||||
fnm unalias version8 |
||||
begin; fnm use version8 2>&1; end | grep 'Requested version version8 is not currently installed'; or echo "Expected output to contain 'Requested version version8 is not currently installed'" && exit 1" |
||||
`; |
||||
|
||||
exports[`Fish unalias errors if alias not found: Fish 1`] = ` |
||||
"fnm env --log-level=error | source |
||||
begin; fnm unalias lts 2>&1; end | grep 'Requested alias lts not found'; or echo "Expected output to contain 'Requested alias lts not found'" && exit 1" |
||||
`; |
||||
|
||||
exports[`PowerShell aliasing versions: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
$($__out__ = $($($__out__ = $(fnm ls | Select-String 8.11.3); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) | Select-String oldie); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
$($__out__ = $($($__out__ = $(fnm ls | Select-String 6.11.3); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) | Select-String older); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm use older |
||||
if ( "$(node --version)" -ne "v6.11.3" ) { echo "Expected node version to be v6.11.3. Got $(node --version)"; exit 1 } |
||||
fnm use oldie |
||||
if ( "$(node --version)" -ne "v8.11.3" ) { echo "Expected node version to be v8.11.3. Got $(node --version)"; exit 1 } |
||||
fnm use default |
||||
if ( "$(node --version)" -ne "v6.11.3" ) { echo "Expected node version to be v6.11.3. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell allows to install an lts if version missing: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm use --install-if-missing |
||||
$($__out__ = $(fnm ls | Select-String lts-latest); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`PowerShell can alias the system node: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm alias system my_system |
||||
$($__out__ = $(fnm ls | Select-String my_system); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
$($__out__ = $(fnm ls | Select-String my_system2); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
$($__out__ = $(fnm use my_system | Select-String 'Bypassing fnm'); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm unalias my_system |
||||
$($__out__ = $(fnm use my_system 2>&1 | Select-String 'Requested version my_system is not currently installed'); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`PowerShell errors when alias is not found: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env --log-level=error | Out-String | Invoke-Expression |
||||
$($__out__ = $(fnm use 2>&1 | Select-String 'Requested version lts-latest is not'); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`PowerShell unalias a version: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install 11.10.0 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11.3 version8 |
||||
$($__out__ = $(fnm ls | Select-String version8); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm unalias version8 |
||||
$($__out__ = $(fnm use version8 2>&1 | Select-String 'Requested version version8 is not currently installed'); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`PowerShell unalias errors if alias not found: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env --log-level=error | Out-String | Invoke-Expression |
||||
$($__out__ = $(fnm unalias lts 2>&1 | Select-String 'Requested alias lts not found'); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`Zsh aliasing versions: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
((fnm ls) | grep 8.11.3 || (echo "Expected output to contain 8.11.3" && exit 1)) | grep oldie || (echo "Expected output to contain oldie" && exit 1) |
||||
((fnm ls) | grep 6.11.3 || (echo "Expected output to contain 6.11.3" && exit 1)) | grep older || (echo "Expected output to contain older" && exit 1) |
||||
fnm use older |
||||
if [ "$(node --version)" != "v6.11.3" ]; then |
||||
echo "Expected node version to be v6.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi |
||||
fnm use oldie |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi |
||||
fnm use default |
||||
if [ "$(node --version)" != "v6.11.3" ]; then |
||||
echo "Expected node version to be v6.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh allows to install an lts if version missing: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm use --install-if-missing |
||||
(fnm ls) | grep lts-latest || (echo "Expected output to contain lts-latest" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Zsh can alias the system node: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm alias system my_system |
||||
(fnm ls) | grep my_system || (echo "Expected output to contain my_system" && exit 1) |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
(fnm ls) | grep my_system2 || (echo "Expected output to contain my_system2" && exit 1) |
||||
(fnm use my_system) | grep 'Bypassing fnm' || (echo "Expected output to contain 'Bypassing fnm'" && exit 1) |
||||
fnm unalias my_system |
||||
(fnm use my_system 2>&1) | grep 'Requested version my_system is not currently installed' || (echo "Expected output to contain 'Requested version my_system is not currently installed'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Zsh errors when alias is not found: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
(fnm use 2>&1) | grep 'Requested version lts-latest is not' || (echo "Expected output to contain 'Requested version lts-latest is not'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Zsh unalias a version: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 11.10.0 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11.3 version8 |
||||
(fnm ls) | grep version8 || (echo "Expected output to contain version8" && exit 1) |
||||
fnm unalias version8 |
||||
(fnm use version8 2>&1) | grep 'Requested version version8 is not currently installed' || (echo "Expected output to contain 'Requested version version8 is not currently installed'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Zsh unalias errors if alias not found: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
(fnm unalias lts 2>&1) | grep 'Requested alias lts not found' || (echo "Expected output to contain 'Requested alias lts not found'" && exit 1)" |
||||
`; |
@ -0,0 +1,284 @@
@@ -0,0 +1,284 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash .node-version: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash .nvmrc: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash \`fnm ls\` with nothing installed: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
if [ "$(fnm ls)" != "* system" ]; then |
||||
echo "Expected fnm ls to be * system. Got $(fnm ls)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash basic usage: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash resolves partial semver: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 6 |
||||
fnm use 6 |
||||
if [ "$(node --version)" != "v6.17.1" ]; then |
||||
echo "Expected node version to be v6.17.1. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash use on cd: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --use-on-cd)" |
||||
fnm install v8.11.3 |
||||
fnm install v12.22.12 |
||||
cd subdir |
||||
if [ "$(node --version)" != "v12.22.12" ]; then |
||||
echo "Expected node version to be v12.22.12. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash when .node-version and .nvmrc are in sync, it throws no error: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v11.10.0" ]; then |
||||
echo "Expected node version to be v11.10.0. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Fish .node-version: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install |
||||
fnm use |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected node version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish .nvmrc: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install |
||||
fnm use |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected node version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish \`fnm ls\` with nothing installed: Fish 1`] = ` |
||||
"fnm env | source |
||||
set ____test____ (fnm ls) |
||||
if test "$____test____" != "* system" |
||||
echo "Expected fnm ls to be * system. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish basic usage: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected node version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish resolves partial semver: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install 6 |
||||
fnm use 6 |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v6.17.1" |
||||
echo "Expected node version to be v6.17.1. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish use on cd: Fish 1`] = ` |
||||
"fnm env --use-on-cd | source |
||||
fnm install v8.11.3 |
||||
fnm install v12.22.12 |
||||
cd subdir |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v12.22.12" |
||||
echo "Expected node version to be v12.22.12. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish when .node-version and .nvmrc are in sync, it throws no error: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install |
||||
fnm use |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v11.10.0" |
||||
echo "Expected node version to be v11.10.0. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`PowerShell .node-version: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install |
||||
fnm use |
||||
if ( "$(node --version)" -ne "v8.11.3" ) { echo "Expected node version to be v8.11.3. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell .nvmrc: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install |
||||
fnm use |
||||
if ( "$(node --version)" -ne "v8.11.3" ) { echo "Expected node version to be v8.11.3. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell \`fnm ls\` with nothing installed: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
if ( "$(fnm ls)" -ne "* system" ) { echo "Expected fnm ls to be * system. Got $(fnm ls)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell basic usage: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if ( "$(node --version)" -ne "v8.11.3" ) { echo "Expected node version to be v8.11.3. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell resolves partial semver: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install 6 |
||||
fnm use 6 |
||||
if ( "$(node --version)" -ne "v6.17.1" ) { echo "Expected node version to be v6.17.1. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell use on cd: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env --use-on-cd | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
fnm install v12.22.12 |
||||
cd subdir |
||||
if ( "$(node --version)" -ne "v12.22.12" ) { echo "Expected node version to be v12.22.12. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell when .node-version and .nvmrc are in sync, it throws no error: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install |
||||
fnm use |
||||
if ( "$(node --version)" -ne "v11.10.0" ) { echo "Expected node version to be v11.10.0. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`Zsh .node-version: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh .nvmrc: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh \`fnm ls\` with nothing installed: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
if [ "$(fnm ls)" != "* system" ]; then |
||||
echo "Expected fnm ls to be * system. Got $(fnm ls)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh basic usage: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh resolves partial semver: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install 6 |
||||
fnm use 6 |
||||
if [ "$(node --version)" != "v6.17.1" ]; then |
||||
echo "Expected node version to be v6.17.1. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh use on cd: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --use-on-cd)" |
||||
fnm install v8.11.3 |
||||
fnm install v12.22.12 |
||||
cd subdir |
||||
if [ "$(node --version)" != "v12.22.12" ]; then |
||||
echo "Expected node version to be v12.22.12. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh when .node-version and .nvmrc are in sync, it throws no error: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node --version)" != "v11.10.0" ]; then |
||||
echo "Expected node version to be v11.10.0. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash current returns the current Node.js version set in fnm: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
if [ "$(fnm current)" != "none" ]; then |
||||
echo "Expected currently activated version to be none. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if [ "$(fnm current)" != "v8.11.3" ]; then |
||||
echo "Expected currently activated version to be v8.11.3. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm use v10.10.0 |
||||
if [ "$(fnm current)" != "v10.10.0" ]; then |
||||
echo "Expected currently activated version to be v10.10.0. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm use system |
||||
if [ "$(fnm current)" != "system" ]; then |
||||
echo "Expected currently activated version to be system. Got $(fnm current)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Fish current returns the current Node.js version set in fnm: Fish 1`] = ` |
||||
"fnm env | source |
||||
set ____test____ (fnm current) |
||||
if test "$____test____" != "none" |
||||
echo "Expected currently activated version to be none. Got $____test____" |
||||
exit 1 |
||||
end |
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
set ____test____ (fnm current) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected currently activated version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end |
||||
fnm use v10.10.0 |
||||
set ____test____ (fnm current) |
||||
if test "$____test____" != "v10.10.0" |
||||
echo "Expected currently activated version to be v10.10.0. Got $____test____" |
||||
exit 1 |
||||
end |
||||
fnm use system |
||||
set ____test____ (fnm current) |
||||
if test "$____test____" != "system" |
||||
echo "Expected currently activated version to be system. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`PowerShell current returns the current Node.js version set in fnm: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
if ( "$(fnm current)" -ne "none" ) { echo "Expected currently activated version to be none. Got $(fnm current)"; exit 1 } |
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if ( "$(fnm current)" -ne "v8.11.3" ) { echo "Expected currently activated version to be v8.11.3. Got $(fnm current)"; exit 1 } |
||||
fnm use v10.10.0 |
||||
if ( "$(fnm current)" -ne "v10.10.0" ) { echo "Expected currently activated version to be v10.10.0. Got $(fnm current)"; exit 1 } |
||||
fnm use system |
||||
if ( "$(fnm current)" -ne "system" ) { echo "Expected currently activated version to be system. Got $(fnm current)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`Zsh current returns the current Node.js version set in fnm: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
if [ "$(fnm current)" != "none" ]; then |
||||
echo "Expected currently activated version to be none. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if [ "$(fnm current)" != "v8.11.3" ]; then |
||||
echo "Expected currently activated version to be v8.11.3. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm use v10.10.0 |
||||
if [ "$(fnm current)" != "v10.10.0" ]; then |
||||
echo "Expected currently activated version to be v10.10.0. Got $(fnm current)" |
||||
exit 1 |
||||
fi |
||||
fnm use system |
||||
if [ "$(fnm current)" != "system" ]; then |
||||
echo "Expected currently activated version to be system. Got $(fnm current)" |
||||
exit 1 |
||||
fi" |
||||
`; |
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash \`exec\` usage: Bash 1`] = ` |
||||
"set -e |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if [ "$(fnm exec -- node -v)" != "v8.10.0" ]; then |
||||
echo "Expected version file exec to be v8.10.0. Got $(fnm exec -- node -v)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm exec --using=6 -- node -v)" != "v6.10.0" ]; then |
||||
echo "Expected exec:6 node -v to be v6.10.0. Got $(fnm exec --using=6 -- node -v)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm exec --using=10 -- node -v)" != "v10.10.0" ]; then |
||||
echo "Expected exec:6 node -v to be v10.10.0. Got $(fnm exec --using=10 -- node -v)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Fish \`exec\` usage: Fish 1`] = ` |
||||
"fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
set ____test____ (fnm exec -- node -v) |
||||
if test "$____test____" != "v8.10.0" |
||||
echo "Expected version file exec to be v8.10.0. Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm exec --using=6 -- node -v) |
||||
if test "$____test____" != "v6.10.0" |
||||
echo "Expected exec:6 node -v to be v6.10.0. Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm exec --using=10 -- node -v) |
||||
if test "$____test____" != "v10.10.0" |
||||
echo "Expected exec:6 node -v to be v10.10.0. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`PowerShell \`exec\` usage: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if ( "$(fnm exec -- node -v)" -ne "v8.10.0" ) { echo "Expected version file exec to be v8.10.0. Got $(fnm exec -- node -v)"; exit 1 } |
||||
if ( "$(fnm exec --using=6 -- node -v)" -ne "v6.10.0" ) { echo "Expected exec:6 node -v to be v6.10.0. Got $(fnm exec --using=6 -- node -v)"; exit 1 } |
||||
if ( "$(fnm exec --using=10 -- node -v)" -ne "v10.10.0" ) { echo "Expected exec:6 node -v to be v10.10.0. Got $(fnm exec --using=10 -- node -v)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`Zsh \`exec\` usage: Zsh 1`] = ` |
||||
"set -e |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if [ "$(fnm exec -- node -v)" != "v8.10.0" ]; then |
||||
echo "Expected version file exec to be v8.10.0. Got $(fnm exec -- node -v)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm exec --using=6 -- node -v)" != "v6.10.0" ]; then |
||||
echo "Expected exec:6 node -v to be v6.10.0. Got $(fnm exec --using=6 -- node -v)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm exec --using=10 -- node -v)" != "v10.10.0" ]; then |
||||
echo "Expected exec:6 node -v to be v10.10.0. Got $(fnm exec --using=10 -- node -v)" |
||||
exit 1 |
||||
fi" |
||||
`; |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash warns about an existing installation: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
(fnm install v8.11.3 2>&1) | grep 'already installed' || (echo "Expected output to contain 'already installed'" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Fish warns about an existing installation: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install v8.11.3 |
||||
begin; fnm install v8.11.3 2>&1; end | grep 'already installed'; or echo "Expected output to contain 'already installed'" && exit 1" |
||||
`; |
||||
|
||||
exports[`PowerShell warns about an existing installation: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
$($__out__ = $(fnm install v8.11.3 2>&1 | Select-String 'already installed'); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`Zsh warns about an existing installation: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
(fnm install v8.11.3 2>&1) | grep 'already installed' || (echo "Expected output to contain 'already installed'" && exit 1)" |
||||
`; |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash installs latest lts: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install --lts |
||||
(fnm ls) | grep lts-latest || (echo "Expected output to contain lts-latest" && exit 1) |
||||
fnm use 'lts/*'" |
||||
`; |
||||
|
||||
exports[`Fish installs latest lts: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install --lts |
||||
begin; fnm ls; end | grep lts-latest; or echo "Expected output to contain lts-latest" && exit 1 |
||||
fnm use 'lts/*'" |
||||
`; |
||||
|
||||
exports[`PowerShell installs latest lts: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install --lts |
||||
$($__out__ = $(fnm ls | Select-String lts-latest); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm use 'lts/*'" |
||||
`; |
||||
|
||||
exports[`Zsh installs latest lts: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install --lts |
||||
(fnm ls) | grep lts-latest || (echo "Expected output to contain lts-latest" && exit 1) |
||||
fnm use 'lts/*'" |
||||
`; |
@ -0,0 +1,127 @@
@@ -0,0 +1,127 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash "quiet" log level: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=quiet)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo "Expected fnm install to be . Got $(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo "Expected fnm use to be . Got $(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Bash error log level: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo "Expected fnm install to be . Got $(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo "Expected fnm use to be . Got $(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi |
||||
(fnm alias abcd efg 2>&1) | grep "find requested version" || (echo "Expected output to contain "find requested version"" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Fish "quiet" log level: Fish 1`] = ` |
||||
"fnm env --log-level=quiet | source |
||||
set ____test____ (fnm install v8.11.3) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm install to be . Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm use v8.11.3) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm use to be . Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm alias v8.11.3 something) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm alias to be . Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`Fish error log level: Fish 1`] = ` |
||||
"fnm env --log-level=error | source |
||||
set ____test____ (fnm install v8.11.3) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm install to be . Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm use v8.11.3) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm use to be . Got $____test____" |
||||
exit 1 |
||||
end |
||||
set ____test____ (fnm alias v8.11.3 something) |
||||
if test "$____test____" != "" |
||||
echo "Expected fnm alias to be . Got $____test____" |
||||
exit 1 |
||||
end |
||||
begin; fnm alias abcd efg 2>&1; end | grep "find requested version"; or echo "Expected output to contain "find requested version"" && exit 1" |
||||
`; |
||||
|
||||
exports[`PowerShell "quiet" log level: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env --log-level=quiet | Out-String | Invoke-Expression |
||||
if ( "$(fnm install v8.11.3)" -ne "" ) { echo "Expected fnm install to be . Got $(fnm install v8.11.3)"; exit 1 } |
||||
if ( "$(fnm use v8.11.3)" -ne "" ) { echo "Expected fnm use to be . Got $(fnm use v8.11.3)"; exit 1 } |
||||
if ( "$(fnm alias v8.11.3 something)" -ne "" ) { echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`PowerShell error log level: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env --log-level=error | Out-String | Invoke-Expression |
||||
if ( "$(fnm install v8.11.3)" -ne "" ) { echo "Expected fnm install to be . Got $(fnm install v8.11.3)"; exit 1 } |
||||
if ( "$(fnm use v8.11.3)" -ne "" ) { echo "Expected fnm use to be . Got $(fnm use v8.11.3)"; exit 1 } |
||||
if ( "$(fnm alias v8.11.3 something)" -ne "" ) { echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)"; exit 1 } |
||||
$($__out__ = $(fnm alias abcd efg 2>&1 | Select-String "find requested version"); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`Zsh "quiet" log level: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=quiet)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo "Expected fnm install to be . Got $(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo "Expected fnm use to be . Got $(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Zsh error log level: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env --log-level=error)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo "Expected fnm install to be . Got $(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo "Expected fnm use to be . Got $(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo "Expected fnm alias to be . Got $(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi |
||||
(fnm alias abcd efg 2>&1) | grep "find requested version" || (echo "Expected output to contain "find requested version"" && exit 1)" |
||||
`; |
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash multishell changes don't affect parent: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
echo 'set -e |
||||
eval "$(fnm env)" |
||||
fnm use v11 |
||||
if [ "$(node --version)" != "v11.9.0" ]; then |
||||
echo "Expected node version to be v11.9.0. Got $(node --version)" |
||||
exit 1 |
||||
fi' | bash |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Fish multishell changes don't affect parent: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
fish -c 'fnm env | source |
||||
fnm use v11 |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v11.9.0" |
||||
echo "Expected node version to be v11.9.0. Got $____test____" |
||||
exit 1 |
||||
end' |
||||
set ____test____ (node --version) |
||||
if test "$____test____" != "v8.11.3" |
||||
echo "Expected node version to be v8.11.3. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`PowerShell multishell changes don't affect parent: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
echo '$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm use v11 |
||||
if ( "$(node --version)" -ne "v11.9.0" ) { echo "Expected node version to be v11.9.0. Got $(node --version)"; exit 1 }' | pwsh -NoProfile |
||||
if ( "$(node --version)" -ne "v8.11.3" ) { echo "Expected node version to be v8.11.3. Got $(node --version)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`Zsh multishell changes don't affect parent: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
echo 'set -e |
||||
eval "$(fnm env)" |
||||
fnm use v11 |
||||
if [ "$(node --version)" != "v11.9.0" ]; then |
||||
echo "Expected node version to be v11.9.0. Got $(node --version)" |
||||
exit 1 |
||||
fi' | zsh |
||||
if [ "$(node --version)" != "v8.11.3" ]; then |
||||
echo "Expected node version to be v8.11.3. Got $(node --version)" |
||||
exit 1 |
||||
fi" |
||||
`; |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash uses .nvmrc with lts definition: Bash 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
(fnm ls) | grep lts-dubnium || (echo "Expected output to contain lts-dubnium" && exit 1)" |
||||
`; |
||||
|
||||
exports[`Fish uses .nvmrc with lts definition: Fish 1`] = ` |
||||
"fnm env | source |
||||
fnm install |
||||
fnm use |
||||
begin; fnm ls; end | grep lts-dubnium; or echo "Expected output to contain lts-dubnium" && exit 1" |
||||
`; |
||||
|
||||
exports[`PowerShell uses .nvmrc with lts definition: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install |
||||
fnm use |
||||
$($__out__ = $(fnm ls | Select-String lts-dubnium); if ($__out__ -eq $null) { exit 1 } else { $__out__ })" |
||||
`; |
||||
|
||||
exports[`Zsh uses .nvmrc with lts definition: Zsh 1`] = ` |
||||
"set -e |
||||
eval "$(fnm env)" |
||||
fnm install |
||||
fnm use |
||||
(fnm ls) | grep lts-dubnium || (echo "Expected output to contain lts-dubnium" && exit 1)" |
||||
`; |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Bash uninstalls a version: Bash 1`] = ` |
||||
"set -e |
||||
fnm install 12.0.0 |
||||
fnm alias 12.0.0 hello |
||||
((fnm ls) | grep v12.0.0 || (echo "Expected output to contain v12.0.0" && exit 1)) | grep hello || (echo "Expected output to contain hello" && exit 1) |
||||
fnm uninstall hello |
||||
if [ "$(fnm ls)" != "* system" ]; then |
||||
echo "Expected fnm ls to be * system. Got $(fnm ls)" |
||||
exit 1 |
||||
fi" |
||||
`; |
||||
|
||||
exports[`Fish uninstalls a version: Fish 1`] = ` |
||||
"fnm install 12.0.0 |
||||
fnm alias 12.0.0 hello |
||||
begin; begin; fnm ls; end | grep v12.0.0; or echo "Expected output to contain v12.0.0" && exit 1; end | grep hello; or echo "Expected output to contain hello" && exit 1 |
||||
fnm uninstall hello |
||||
set ____test____ (fnm ls) |
||||
if test "$____test____" != "* system" |
||||
echo "Expected fnm ls to be * system. Got $____test____" |
||||
exit 1 |
||||
end" |
||||
`; |
||||
|
||||
exports[`PowerShell uninstalls a version: PowerShell 1`] = ` |
||||
"$ErrorActionPreference = "Stop" |
||||
fnm install 12.0.0 |
||||
fnm alias 12.0.0 hello |
||||
$($__out__ = $($($__out__ = $(fnm ls | Select-String v12.0.0); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) | Select-String hello); if ($__out__ -eq $null) { exit 1 } else { $__out__ }) |
||||
fnm uninstall hello |
||||
if ( "$(fnm ls)" -ne "* system" ) { echo "Expected fnm ls to be * system. Got $(fnm ls)"; exit 1 }" |
||||
`; |
||||
|
||||
exports[`Zsh uninstalls a version: Zsh 1`] = ` |
||||
"set -e |
||||
fnm install 12.0.0 |
||||
fnm alias 12.0.0 hello |
||||
((fnm ls) | grep v12.0.0 || (echo "Expected output to contain v12.0.0" && exit 1)) | grep hello || (echo "Expected output to contain hello" && exit 1) |
||||
fnm uninstall hello |
||||
if [ "$(fnm ls)" != "* system" ]; then |
||||
echo "Expected fnm ls to be * system. Got $(fnm ls)" |
||||
exit 1 |
||||
fi" |
||||
`; |
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
import { writeFile } from "node:fs/promises" |
||||
import path from "node:path" |
||||
import testCwd from "./shellcode/test-cwd" |
||||
import getStderr from "./shellcode/get-stderr" |
||||
import testNodeVersion from "./shellcode/test-node-version" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`allows to install an lts if version missing`, async () => { |
||||
await writeFile(path.join(testCwd(), ".node-version"), "lts/*") |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["use", "--install-if-missing"])) |
||||
.then( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "lts-latest") |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`errors when alias is not found`, async () => { |
||||
await writeFile(path.join(testCwd(), ".node-version"), "lts/*") |
||||
await script(shell) |
||||
.then(shell.env({ logLevel: "error" })) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["use"])), |
||||
"'Requested version lts-latest is not'" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`unalias a version`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "11.10.0"])) |
||||
.then(shell.call("fnm", ["install", "8.11.3"])) |
||||
.then(shell.call("fnm", ["alias", "8.11.3", "version8"])) |
||||
.then(shell.scriptOutputContains(shell.call("fnm", ["ls"]), "version8")) |
||||
.then(shell.call("fnm", ["unalias", "version8"])) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["use", "version8"])), |
||||
"'Requested version version8 is not currently installed'" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`unalias errors if alias not found`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({ logLevel: "error" })) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["unalias", "lts"])), |
||||
"'Requested alias lts not found'" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`can alias the system node`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["alias", "system", "my_system"])) |
||||
.then( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "my_system") |
||||
) |
||||
.then(shell.call("fnm", ["alias", "system", "default"])) |
||||
.then(shell.call("fnm", ["alias", "my_system", "my_system2"])) |
||||
.then( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "my_system2") |
||||
) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
shell.call("fnm", ["use", "my_system"]), |
||||
"'Bypassing fnm'" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["unalias", "my_system"])) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["use", "my_system"])), |
||||
"'Requested version my_system is not currently installed'" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`aliasing versions`, async () => { |
||||
const installedVersions = shell.call("fnm", ["ls"]) |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "6.11.3"])) |
||||
.then(shell.call("fnm", ["install", "8.11.3"])) |
||||
.then(shell.call("fnm", ["alias", "8.11", "oldie"])) |
||||
.then(shell.call("fnm", ["alias", "6", "older"])) |
||||
.then(shell.call("fnm", ["default", "older"])) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
shell.scriptOutputContains(installedVersions, "8.11.3"), |
||||
"oldie" |
||||
) |
||||
) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
shell.scriptOutputContains(installedVersions, "6.11.3"), |
||||
"older" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["use", "older"])) |
||||
.then(testNodeVersion(shell, "v6.11.3")) |
||||
.then(shell.call("fnm", ["use", "oldie"])) |
||||
.then(testNodeVersion(shell, "v8.11.3")) |
||||
.then(shell.call("fnm", ["use", "default"])) |
||||
.then(testNodeVersion(shell, "v6.11.3")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
import { writeFile, mkdir } from "node:fs/promises" |
||||
import { join } from "node:path" |
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, WinCmd, Zsh } from "./shellcode/shells" |
||||
import testCwd from "./shellcode/test-cwd" |
||||
import testNodeVersion from "./shellcode/test-node-version" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell, WinCmd]) { |
||||
describe(shell, () => { |
||||
test(`basic usage`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "v8.11.3"])) |
||||
.then(shell.call("fnm", ["use", "v8.11.3"])) |
||||
.then(testNodeVersion(shell, "v8.11.3")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`.nvmrc`, async () => { |
||||
await writeFile(join(testCwd(), ".nvmrc"), "v8.11.3") |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install"])) |
||||
.then(shell.call("fnm", ["use"])) |
||||
.then(testNodeVersion(shell, "v8.11.3")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`.node-version`, async () => { |
||||
await writeFile(join(testCwd(), ".node-version"), "v8.11.3") |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install"])) |
||||
.then(shell.call("fnm", ["use"])) |
||||
.then(testNodeVersion(shell, "v8.11.3")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`use on cd`, async () => { |
||||
await mkdir(join(testCwd(), "subdir"), { recursive: true }) |
||||
await writeFile(join(testCwd(), "subdir", ".node-version"), "v12.22.12") |
||||
await script(shell) |
||||
.then(shell.env({ useOnCd: true })) |
||||
.then(shell.call("fnm", ["install", "v8.11.3"])) |
||||
.then(shell.call("fnm", ["install", "v12.22.12"])) |
||||
.then(shell.call("cd", ["subdir"])) |
||||
.then(testNodeVersion(shell, "v12.22.12")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`resolves partial semver`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "6"])) |
||||
.then(shell.call("fnm", ["use", "6"])) |
||||
.then(testNodeVersion(shell, "v6.17.1")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test("`fnm ls` with nothing installed", async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["ls"]), |
||||
"* system", |
||||
"fnm ls" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test(`when .node-version and .nvmrc are in sync, it throws no error`, async () => { |
||||
await writeFile(join(testCwd(), ".nvmrc"), "v11.10.0") |
||||
await writeFile(join(testCwd(), ".node-version"), "v11.10.0") |
||||
|
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install"])) |
||||
.then(shell.call("fnm", ["use"])) |
||||
.then(testNodeVersion(shell, "v11.10.0")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, WinCmd, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell, WinCmd]) { |
||||
describe(shell, () => { |
||||
test(`current returns the current Node.js version set in fnm`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["current"]), |
||||
"none", |
||||
"currently activated version" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["install", "v8.11.3"])) |
||||
.then(shell.call("fnm", ["install", "v10.10.0"])) |
||||
.then(shell.call("fnm", ["use", "v8.11.3"])) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["current"]), |
||||
"v8.11.3", |
||||
"currently activated version" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["use", "v10.10.0"])) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["current"]), |
||||
"v10.10.0", |
||||
"currently activated version" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["use", "system"])) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["current"]), |
||||
"system", |
||||
"currently activated version" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
import { WinCmd } from "./shellcode/shells" |
||||
import { Shell } from "./shellcode/shells/types" |
||||
|
||||
export default function describe( |
||||
shell: Pick<Shell, "name">, |
||||
fn: () => void |
||||
): void { |
||||
if (shell === WinCmd) { |
||||
// wincmd tests do not work right now and I don't have a Windows machine to fix it
|
||||
// maybe in the future when I have some time to spin a VM to check what's happening.
|
||||
return globalThis.describe.skip("WinCmd", fn) |
||||
} |
||||
|
||||
globalThis.describe(shell.name(), fn) |
||||
} |
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, WinCmd, Zsh } from "./shellcode/shells" |
||||
import testCwd from "./shellcode/test-cwd" |
||||
import fs from "node:fs/promises" |
||||
import path from "node:path" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell, WinCmd]) { |
||||
describe(shell, () => { |
||||
test("`exec` usage", async () => { |
||||
await fs.writeFile(path.join(testCwd(), ".nvmrc"), "v8.10.0") |
||||
|
||||
await script(shell) |
||||
.then(shell.call("fnm", ["install"])) |
||||
.then(shell.call("fnm", ["install", "v6.10.0"])) |
||||
.then(shell.call("fnm", ["install", "v10.10.0"])) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["exec", "--", "node", "-v"]), |
||||
"v8.10.0", |
||||
"version file exec" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["exec", "--using=6", "--", "node", "-v"]), |
||||
"v6.10.0", |
||||
"exec:6 node -v" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["exec", "--using=10", "--", "node", "-v"]), |
||||
"v10.10.0", |
||||
"exec:6 node -v" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
import getStderr from "./shellcode/get-stderr" |
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`warns about an existing installation`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "v8.11.3"])) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["install", "v8.11.3"])), |
||||
"'already installed'" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`installs latest lts`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "--lts"])) |
||||
.then( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "lts-latest") |
||||
) |
||||
.then(shell.call("fnm", ["use", "'lts/*'"])) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
import getStderr from "./shellcode/get-stderr" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`"quiet" log level`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({ logLevel: "quiet" })) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["install", "v8.11.3"]), |
||||
"", |
||||
"fnm install" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["use", "v8.11.3"]), |
||||
"", |
||||
"fnm use" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["alias", "v8.11.3", "something"]), |
||||
"", |
||||
"fnm alias" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
|
||||
test("error log level", async () => { |
||||
await script(shell) |
||||
.then(shell.env({ logLevel: "error" })) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["install", "v8.11.3"]), |
||||
"", |
||||
"fnm install" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["use", "v8.11.3"]), |
||||
"", |
||||
"fnm use" |
||||
) |
||||
) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["alias", "v8.11.3", "something"]), |
||||
"", |
||||
"fnm alias" |
||||
) |
||||
) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
getStderr(shell.call("fnm", ["alias", "abcd", "efg"])), |
||||
`"find requested version"` |
||||
) |
||||
) |
||||
|
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import testNodeVersion from "./shellcode/test-node-version" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`multishell changes don't affect parent`, async () => { |
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "v8.11.3"])) |
||||
.then(shell.call("fnm", ["install", "v11.9.0"])) |
||||
.then( |
||||
shell.inSubShell( |
||||
script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["use", "v11"])) |
||||
.then(testNodeVersion(shell, "v11.9.0")) |
||||
.asLine() |
||||
) |
||||
) |
||||
.then(testNodeVersion(shell, "v8.11.3")) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import fs from "node:fs/promises" |
||||
import path from "node:path" |
||||
import describe from "./describe" |
||||
import testCwd from "./shellcode/test-cwd" |
||||
|
||||
for (const shell of [Bash, Fish, PowerShell, Zsh]) { |
||||
describe(shell, () => { |
||||
test(`uses .nvmrc with lts definition`, async () => { |
||||
await fs.writeFile(path.join(testCwd(), ".nvmrc"), `lts/dubnium`) |
||||
|
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install"])) |
||||
.then(shell.call("fnm", ["use"])) |
||||
.then( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "lts-dubnium") |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
export default function getStderr(script: string): string { |
||||
return `${script} 2>&1` |
||||
} |
@ -0,0 +1,170 @@
@@ -0,0 +1,170 @@
|
||||
import { ScriptLine, Shell } from "./shells/types" |
||||
import execa from "execa" |
||||
import testTmpDir from "./test-tmp-dir" |
||||
import { Writable } from "node:stream" |
||||
import dedent from "ts-dedent" |
||||
import testCwd from "./test-cwd" |
||||
import path, { join } from "node:path" |
||||
import { writeFile } from "node:fs/promises" |
||||
import chalk from "chalk" |
||||
import testBinDir from "./test-bin-dir" |
||||
|
||||
class Script { |
||||
constructor( |
||||
private readonly config: { |
||||
fnmDir: string |
||||
}, |
||||
private readonly lines: ScriptLine[] |
||||
) {} |
||||
then(line: ScriptLine): Script { |
||||
return new Script(this.config, [...this.lines, line]) |
||||
} |
||||
|
||||
takeSnapshot(shell: Pick<Shell, "name">): this { |
||||
const script = this.lines.join("\n") |
||||
expect(script).toMatchSnapshot(shell.name()) |
||||
|
||||
return this |
||||
} |
||||
|
||||
async execute( |
||||
shell: Pick< |
||||
Shell, |
||||
"binaryName" | "launchArgs" | "currentlySupported" | "forceFile" |
||||
> |
||||
): Promise<void> { |
||||
if (!shell.currentlySupported()) { |
||||
return |
||||
} |
||||
|
||||
const args = [...shell.launchArgs()] |
||||
|
||||
if (shell.forceFile) { |
||||
const filename = join(testTmpDir(), "script") |
||||
await writeFile(filename, [...this.lines, "exit 0"].join("\n")) |
||||
args.push(filename) |
||||
} |
||||
|
||||
const child = execa(shell.binaryName(), args, { |
||||
stdio: [shell.forceFile ? "ignore" : "pipe", "pipe", "pipe"], |
||||
cwd: testCwd(), |
||||
env: { |
||||
...removeAllFnmEnvVars(process.env), |
||||
PATH: [testBinDir(), fnmTargetDir(), process.env.PATH] |
||||
.filter(Boolean) |
||||
.join(path.delimiter), |
||||
FNM_DIR: this.config.fnmDir, |
||||
}, |
||||
extendEnv: false, |
||||
reject: false, |
||||
}) |
||||
|
||||
if (child.stdin) { |
||||
const childStdin = child.stdin |
||||
|
||||
for (const line of this.lines) { |
||||
await write(childStdin, `${line}\n`) |
||||
} |
||||
|
||||
await write(childStdin, "exit 0\n") |
||||
} |
||||
|
||||
const { stdout, stderr } = streamOutputsAndBuffer(child) |
||||
|
||||
const finished = await child |
||||
|
||||
if (finished.failed) { |
||||
console.error( |
||||
dedent` |
||||
Script failed. |
||||
code ${finished.exitCode} |
||||
signal ${finished.signal} |
||||
|
||||
stdout: |
||||
${padAllLines(stdout.join(""), 2)} |
||||
|
||||
stderr: |
||||
${padAllLines(stderr.join(""), 2)} |
||||
` |
||||
) |
||||
|
||||
throw new Error( |
||||
`Script failed on ${testCwd()} with code ${finished.exitCode}` |
||||
) |
||||
} |
||||
} |
||||
|
||||
asLine(): ScriptLine { |
||||
return this.lines.join("\n") |
||||
} |
||||
} |
||||
|
||||
function streamOutputsAndBuffer(child: execa.ExecaChildProcess) { |
||||
const stdout: string[] = [] |
||||
const stderr: string[] = [] |
||||
const testName = expect.getState().currentTestName ?? "unknown" |
||||
const testPath = expect.getState().testPath ?? "unknown" |
||||
|
||||
const stdoutPrefix = chalk.yellow.dim(`[stdout] ${testPath}/${testName}: `) |
||||
const stderrPrefix = chalk.red.dim(`[stderr] ${testPath}/${testName}: `) |
||||
|
||||
if (child.stdout) { |
||||
child.stdout.on("data", (data) => { |
||||
const line = data.toString().trim() |
||||
if (line) { |
||||
process.stdout.write(`${stdoutPrefix}${line}\n`) |
||||
} |
||||
stdout.push(data.toString()) |
||||
}) |
||||
} |
||||
|
||||
if (child.stderr) { |
||||
child.stderr.on("data", (data) => { |
||||
const line = data.toString().trim() |
||||
if (line) { |
||||
process.stdout.write(`${stderrPrefix}${line}\n`) |
||||
} |
||||
stderr.push(data.toString()) |
||||
}) |
||||
} |
||||
|
||||
return { stdout, stderr } |
||||
} |
||||
|
||||
function padAllLines(text: string, padding: number): string { |
||||
return text |
||||
.split("\n") |
||||
.map((line) => " ".repeat(padding) + line) |
||||
.join("\n") |
||||
} |
||||
|
||||
function write(writable: Writable, text: string): Promise<void> { |
||||
return new Promise<void>((resolve, reject) => { |
||||
writable.write(text, (err) => { |
||||
if (err) return reject(err) |
||||
return resolve() |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
export function script(shell: Pick<Shell, "dieOnErrors">): Script { |
||||
const fnmDir = `${testTmpDir()}/fnm` |
||||
return new Script({ fnmDir }, shell.dieOnErrors ? [shell.dieOnErrors()] : []) |
||||
} |
||||
|
||||
function removeAllFnmEnvVars(obj: NodeJS.ProcessEnv): NodeJS.ProcessEnv { |
||||
const result: NodeJS.ProcessEnv = {} |
||||
for (const [key, value] of Object.entries(obj)) { |
||||
if (!key.startsWith("FNM_")) { |
||||
result[key] = value |
||||
} |
||||
} |
||||
return result |
||||
} |
||||
|
||||
function fnmTargetDir(): string { |
||||
return path.resolve( |
||||
__dirname, |
||||
`../../target/${process.env.FNM_TARGET_NAME ?? "debug"}` |
||||
) |
||||
} |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
import { define, ScriptLine } from "./types" |
||||
|
||||
export type HasCall = { |
||||
call: (binary: string, args: string[]) => ScriptLine |
||||
} |
||||
|
||||
export const cmdCall = { |
||||
all: define<HasCall>({ |
||||
call: (binary: string, args: string[]) => |
||||
`${binary} ${args.join(" ")}` as ScriptLine, |
||||
}), |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
import { ScriptLine, define } from "./types" |
||||
|
||||
type EnvConfig = { useOnCd: boolean; logLevel: string } |
||||
export type HasEnv = { env(cfg: Partial<EnvConfig>): ScriptLine } |
||||
|
||||
function stringify(envConfig: Partial<EnvConfig> = {}) { |
||||
const { useOnCd, logLevel } = envConfig |
||||
return [ |
||||
`fnm env`, |
||||
useOnCd && "--use-on-cd", |
||||
logLevel && `--log-level=${logLevel}`, |
||||
] |
||||
.filter(Boolean) |
||||
.join(" ") |
||||
} |
||||
|
||||
export const cmdEnv = { |
||||
bash: define<HasEnv>({ |
||||
env: (envConfig) => `eval "$(${stringify(envConfig)})"`, |
||||
}), |
||||
fish: define<HasEnv>({ |
||||
env: (envConfig) => `${stringify(envConfig)} | source`, |
||||
}), |
||||
powershell: define<HasEnv>({ |
||||
env: (envConfig) => |
||||
`${stringify(envConfig)} | Out-String | Invoke-Expression`, |
||||
}), |
||||
wincmd: define<HasEnv>({ |
||||
env: (envConfig) => |
||||
`FOR /f "tokens=*" %i IN ('${stringify(envConfig)}') DO CALL %i`, |
||||
}), |
||||
} |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
import dedent from "ts-dedent" |
||||
import { define, ScriptLine } from "./types" |
||||
|
||||
export type HasExpectCommandOutput = { |
||||
hasCommandOutput( |
||||
script: ScriptLine, |
||||
output: string, |
||||
message: string |
||||
): ScriptLine |
||||
} |
||||
|
||||
export const cmdExpectCommandOutput = { |
||||
bash: define<HasExpectCommandOutput>({ |
||||
hasCommandOutput(script, output, message) { |
||||
return dedent` |
||||
if [ "$(${script})" != "${output}" ]; then |
||||
echo "Expected ${message} to be ${output}. Got $(${script})" |
||||
exit 1 |
||||
fi |
||||
` |
||||
}, |
||||
}), |
||||
fish: define<HasExpectCommandOutput>({ |
||||
hasCommandOutput(script, output, message) { |
||||
return dedent` |
||||
set ____test____ (${script}) |
||||
if test "$____test____" != "${output}" |
||||
echo "Expected ${message} to be ${output}. Got $____test____" |
||||
exit 1 |
||||
end |
||||
` |
||||
}, |
||||
}), |
||||
powershell: define<HasExpectCommandOutput>({ |
||||
hasCommandOutput(script, output, message) { |
||||
return dedent` |
||||
if ( "$(${script})" -ne "${output}" ) { echo "Expected ${message} to be ${output}. Got $(${script})"; exit 1 } |
||||
` |
||||
}, |
||||
}), |
||||
wincmd: define<HasExpectCommandOutput>({ |
||||
hasCommandOutput(script, output, message) { |
||||
return dedent` |
||||
${script} | findstr ${output} |
||||
if %errorlevel% neq 0 ( |
||||
echo Expected ${message} to be ${output} |
||||
exit 1 |
||||
) |
||||
` |
||||
}, |
||||
}), |
||||
} |
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
import { cmdCall } from "./cmdCall" |
||||
import { cmdEnv } from "./cmdEnv" |
||||
import { cmdExpectCommandOutput } from "./expect-command-output" |
||||
import { cmdHasOutputContains } from "./output-contains" |
||||
import { redirectOutput } from "./redirect-output" |
||||
import { cmdInSubShell } from "./sub-shell" |
||||
import { define, Shell } from "./types" |
||||
|
||||
export const Bash = { |
||||
...define<Shell>({ |
||||
binaryName: () => "bash", |
||||
currentlySupported: () => true, |
||||
name: () => "Bash", |
||||
launchArgs: () => ["-i"], |
||||
escapeText: (x) => x, |
||||
dieOnErrors: () => `set -e`, |
||||
}), |
||||
...cmdEnv.bash, |
||||
...cmdCall.all, |
||||
...redirectOutput.bash, |
||||
...cmdExpectCommandOutput.bash, |
||||
...cmdHasOutputContains.bash, |
||||
...cmdInSubShell.bash, |
||||
} |
||||
|
||||
export const Zsh = { |
||||
...define<Shell>({ |
||||
binaryName: () => "zsh", |
||||
currentlySupported: () => process.platform !== "win32", |
||||
name: () => "Zsh", |
||||
launchArgs: () => [], |
||||
escapeText: (x) => x, |
||||
dieOnErrors: () => `set -e`, |
||||
}), |
||||
...cmdEnv.bash, |
||||
...cmdCall.all, |
||||
...cmdExpectCommandOutput.bash, |
||||
...cmdHasOutputContains.bash, |
||||
...cmdInSubShell.zsh, |
||||
} |
||||
|
||||
export const Fish = { |
||||
...define<Shell>({ |
||||
binaryName: () => "fish", |
||||
currentlySupported: () => process.platform !== "win32", |
||||
name: () => "Fish", |
||||
launchArgs: () => [], |
||||
escapeText: (x) => x, |
||||
forceFile: true, |
||||
}), |
||||
...cmdEnv.fish, |
||||
...cmdCall.all, |
||||
...redirectOutput.bash, |
||||
...cmdExpectCommandOutput.fish, |
||||
...cmdHasOutputContains.fish, |
||||
...cmdInSubShell.fish, |
||||
} |
||||
|
||||
export const PowerShell = { |
||||
...define<Shell>({ |
||||
binaryName: () => { |
||||
if (process.platform === "win32") { |
||||
return "powershell.exe" |
||||
} else { |
||||
return "pwsh" |
||||
} |
||||
}, |
||||
forceFile: true, |
||||
currentlySupported: () => true, |
||||
name: () => "PowerShell", |
||||
launchArgs: () => ["-NoProfile"], |
||||
escapeText: (x) => x, |
||||
dieOnErrors: () => `$ErrorActionPreference = "Stop"`, |
||||
}), |
||||
...cmdEnv.powershell, |
||||
...cmdCall.all, |
||||
...cmdExpectCommandOutput.powershell, |
||||
...cmdHasOutputContains.powershell, |
||||
...cmdInSubShell.powershell, |
||||
} |
||||
|
||||
export const WinCmd = { |
||||
...define<Shell>({ |
||||
binaryName: () => "cmd.exe", |
||||
currentlySupported: () => process.platform === "win32", |
||||
name: () => "Windows Command Prompt", |
||||
launchArgs: () => [], |
||||
escapeText: (str) => |
||||
str |
||||
.replace(/\r/g, "") |
||||
.replace(/\n/g, "^\n\n") |
||||
.replace(/\%/g, "%%") |
||||
.replace(/\|/g, "^|") |
||||
.replace(/\(/g, "^(") |
||||
.replace(/\)/g, "^)"), |
||||
}), |
||||
...cmdEnv.wincmd, |
||||
...cmdCall.all, |
||||
...cmdExpectCommandOutput.wincmd, |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
import { define, ScriptLine } from "./types" |
||||
|
||||
export type HasOutputContains = { |
||||
scriptOutputContains(script: ScriptLine, substring: string): ScriptLine |
||||
} |
||||
|
||||
export const cmdHasOutputContains = { |
||||
bash: define<HasOutputContains>({ |
||||
scriptOutputContains: (script, substring) => { |
||||
return `(${script}) | grep ${substring} || (echo "Expected output to contain ${substring}" && exit 1)` |
||||
}, |
||||
}), |
||||
fish: define<HasOutputContains>({ |
||||
scriptOutputContains: (script, substring) => { |
||||
return `begin; ${script}; end | grep ${substring}; or echo "Expected output to contain ${substring}" && exit 1` |
||||
}, |
||||
}), |
||||
powershell: define<HasOutputContains>({ |
||||
scriptOutputContains: (script, substring) => { |
||||
const inner: string = `${script} | Select-String ${substring}` |
||||
return `$($__out__ = $(${inner}); if ($__out__ -eq $null) { exit 1 } else { $__out__ })` |
||||
}, |
||||
}), |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
import { ScriptLine, define } from "./types" |
||||
|
||||
type RedirectOutputOpts = { output: string } |
||||
export type HasRedirectOutput = { |
||||
redirectOutput(childCommand: ScriptLine, opts: RedirectOutputOpts): string |
||||
} |
||||
|
||||
export const redirectOutput = { |
||||
bash: define<HasRedirectOutput>({ |
||||
redirectOutput: (childCommand, opts) => |
||||
`(${childCommand}) > ${opts.output}`, |
||||
}), |
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
import { ScriptLine, define } from "./types" |
||||
import quote from "shell-escape" |
||||
|
||||
type HasInSubShell = { inSubShell: (script: ScriptLine) => ScriptLine } |
||||
|
||||
export const cmdInSubShell = { |
||||
bash: define<HasInSubShell>({ |
||||
inSubShell: (script) => `echo ${quote([script])} | bash`, |
||||
}), |
||||
zsh: define<HasInSubShell>({ |
||||
inSubShell: (script) => `echo ${quote([script])} | zsh`, |
||||
}), |
||||
fish: define<HasInSubShell>({ |
||||
inSubShell: (script) => `fish -c ${quote([script])}`, |
||||
}), |
||||
powershell: define<HasInSubShell>({ |
||||
inSubShell: (script) => |
||||
`echo '${script.replace(/'/g, "\\'")}' | pwsh -NoProfile`, |
||||
}), |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
export type Shell = { |
||||
escapeText(str: string): string |
||||
binaryName(): string |
||||
currentlySupported(): boolean |
||||
name(): string |
||||
launchArgs(): string[] |
||||
dieOnErrors?(): string |
||||
forceFile?: true |
||||
} |
||||
|
||||
export type ScriptLine = string |
||||
|
||||
export function define<S>(s: S): S { |
||||
return s |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
import { mkdirSync } from "node:fs" |
||||
import path from "node:path" |
||||
import testTmpDir from "./test-tmp-dir" |
||||
|
||||
export default function testBinDir() { |
||||
const dir = path.join(testTmpDir(), "bin") |
||||
mkdirSync(dir, { recursive: true }) |
||||
return dir |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
import { mkdirSync } from "node:fs" |
||||
import path from "node:path" |
||||
import testTmpDir from "./test-tmp-dir" |
||||
|
||||
export default function testCwd() { |
||||
const dir = path.join(testTmpDir(), "cwd") |
||||
mkdirSync(dir, { recursive: true }) |
||||
return dir |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
import { HasCall } from "./shells/cmdCall" |
||||
import { ScriptLine } from "./shells/types" |
||||
import { HasExpectCommandOutput } from "./shells/expect-command-output" |
||||
|
||||
export default function testNodeVersion< |
||||
S extends HasCall & HasExpectCommandOutput |
||||
>(shell: S, version: string): ScriptLine { |
||||
const nodeVersion = shell.call("node", ["--version"]) |
||||
return shell.hasCommandOutput(nodeVersion, version, "node version") |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
import { mkdirSync, rmSync } from "node:fs" |
||||
import { tmpdir } from "node:os" |
||||
import { join } from "node:path" |
||||
|
||||
export default function testTmpDir(): string { |
||||
const testName = (expect.getState().currentTestName ?? "unknown") |
||||
.toLowerCase() |
||||
.replace(/[^a-z0-9]/gi, "_") |
||||
.replace(/_+/g, "_") |
||||
const tmpDir = join(tmpdir(), `shellcode/${testName}`) |
||||
mkdirSync(tmpDir, { recursive: true }) |
||||
rmSync(join(tmpDir, "fnm/aliases"), { recursive: true, force: true }) |
||||
|
||||
return tmpDir |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, WinCmd, Zsh } from "./shellcode/shells" |
||||
import fs from "node:fs/promises" |
||||
import path from "node:path" |
||||
import describe from "./describe" |
||||
import testNodeVersion from "./shellcode/test-node-version" |
||||
import testBinDir from "./shellcode/test-bin-dir" |
||||
|
||||
for (const shell of [Bash, Fish, PowerShell, WinCmd, Zsh]) { |
||||
describe(shell, () => { |
||||
// latest bash breaks this as it seems. gotta find a solution.
|
||||
const t = process.platform === "darwin" && shell === Bash ? test.skip : test |
||||
|
||||
t(`switches to system node`, async () => { |
||||
const customNode = path.join(testBinDir(), "node") |
||||
|
||||
if ( |
||||
process.platform === "win32" && |
||||
[WinCmd, PowerShell].includes(shell) |
||||
) { |
||||
await fs.writeFile(customNode + ".cmd", '@echo "custom node"') |
||||
} else { |
||||
await fs.writeFile(customNode, `#!/bin/bash\n\necho "custom"\n`) |
||||
// set executable
|
||||
await fs.chmod(customNode, 0o766) |
||||
} |
||||
|
||||
await script(shell) |
||||
.then(shell.env({})) |
||||
.then(shell.call("fnm", ["install", "v10.10.0"])) |
||||
.then(shell.call("fnm", ["use", "v10"])) |
||||
.then(testNodeVersion(shell, "v10.10.0")) |
||||
.then(shell.call("fnm", ["use", "system"])) |
||||
.then(testNodeVersion(shell, "custom")) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
import { script } from "./shellcode/script" |
||||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells" |
||||
import describe from "./describe" |
||||
|
||||
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
||||
describe(shell, () => { |
||||
test(`uninstalls a version`, async () => { |
||||
await script(shell) |
||||
.then(shell.call("fnm", ["install", "12.0.0"])) |
||||
.then(shell.call("fnm", ["alias", "12.0.0", "hello"])) |
||||
.then( |
||||
shell.scriptOutputContains( |
||||
shell.scriptOutputContains(shell.call("fnm", ["ls"]), "v12.0.0"), |
||||
"hello" |
||||
) |
||||
) |
||||
.then(shell.call("fnm", ["uninstall", "hello"])) |
||||
.then( |
||||
shell.hasCommandOutput( |
||||
shell.call("fnm", ["ls"]), |
||||
"* system", |
||||
"fnm ls" |
||||
) |
||||
) |
||||
.takeSnapshot(shell) |
||||
.execute(shell) |
||||
}) |
||||
}) |
||||
} |
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
#[macro_use] |
||||
mod shellcode; |
||||
|
||||
mod feature_tests; |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
use crate::shellcode::*; |
||||
|
||||
fn installed_versions() -> Call { |
||||
Call::new("fnm", vec!["ls"]) |
||||
} |
||||
|
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "6.11.3"])) |
||||
.then(Call::new("fnm", vec!["install", "8.11.3"])) |
||||
.then(Call::new("fnm", vec!["alias", "8.11", "oldie"])) |
||||
.then(Call::new("fnm", vec!["alias", "6", "older"])) |
||||
.then(Call::new("fnm", vec!["default", "older"])) |
||||
.then(OutputContains::new( |
||||
OutputContains::new(installed_versions(), "8.11.3"), |
||||
"oldie", |
||||
)) |
||||
.then(OutputContains::new( |
||||
OutputContains::new(OutputContains::new(installed_versions(), "6.11.3"), "older"), |
||||
"default", |
||||
)) |
||||
.then(Call::new("fnm", vec!["use", "older"])) |
||||
.then(test_node_version("v6.11.3")) |
||||
.then(Call::new("fnm", vec!["use", "oldie"])) |
||||
.then(test_node_version("v8.11.3")) |
||||
.then(Call::new("fnm", vec!["use", "default"])) |
||||
.then(test_node_version("v6.11.3")) |
||||
}); |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["current"]), |
||||
"none", |
||||
"currently activated version", |
||||
)) |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(Call::new("fnm", vec!["install", "v10.10.0"])) |
||||
.then(Call::new("fnm", vec!["use", "v8.11.3"])) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["current"]), |
||||
"v8.11.3", |
||||
"currently activated version", |
||||
)) |
||||
.then(Call::new("fnm", vec!["use", "v10.10.0"])) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["current"]), |
||||
"v10.10.0", |
||||
"currently activated version", |
||||
)) |
||||
.then(Call::new("fnm", vec!["use", "system"])) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["current"]), |
||||
"system", |
||||
"currently activated version", |
||||
)) |
||||
}); |
@ -1,254 +0,0 @@
@@ -1,254 +0,0 @@
|
||||
mod aliases; |
||||
mod current; |
||||
mod uninstall; |
||||
|
||||
use crate::shellcode::*; |
||||
|
||||
mod basic { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(Call::new("fnm", vec!["use", "v8.11.3"])) |
||||
.then(test_node_version("v8.11.3")) |
||||
}); |
||||
} |
||||
|
||||
mod nvmrc { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(WriteFile::new(".nvmrc", "v8.11.3")) |
||||
.then(Call::new("fnm", vec!["install"])) |
||||
.then(Call::new("fnm", vec!["use"])) |
||||
.then(test_node_version("v8.11.3")) |
||||
}); |
||||
} |
||||
|
||||
mod multishell { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(Call::new("fnm", vec!["install", "v11.9.0"])) |
||||
.then(Call::new("fnm", vec!["use", "v8.11.3"])) |
||||
.then(SubShell::new( |
||||
DieOnErrors |
||||
.then(EvalFnmEnv::default()) |
||||
.then(Call::new("fnm", vec!["use", "11"])) |
||||
.then(test_node_version("v11.9.0")), |
||||
)) |
||||
.then(test_node_version("v8.11.3")) |
||||
}); |
||||
} |
||||
|
||||
mod use_on_cd_nvmrc { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.use_on_cd(true) |
||||
.then(Call::new("mkdir", vec!["inner_path"])) |
||||
.then(WriteFile::new("inner_path/.nvmrc", "v8.11.3")) |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(Call::new("cd", vec!["inner_path"])) |
||||
.then(test_node_version("v8.11.3")) |
||||
}); |
||||
} |
||||
|
||||
mod use_on_cd_dot_node_version { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.use_on_cd(true) |
||||
.then(Call::new("mkdir", vec!["inner_path"])) |
||||
.then(WriteFile::new("inner_path/.node-version", "v8.11.3")) |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(Call::new("cd", vec!["inner_path"])) |
||||
.then(test_node_version("v8.11.3")) |
||||
}); |
||||
} |
||||
|
||||
// mod node_dist_mirror {
|
||||
// test_shell!(Zsh, Bash, Fish, PowerShell, {
|
||||
// EvalFnmEnv::default()
|
||||
// .node_dist_mirror(Some("https://npm.taobao.org/mirrors/node"))
|
||||
// .then(Call::new("fnm", vec!["install", "v8.11.3"]))
|
||||
// .then(Call::new("fnm", vec!["use", "v8.11.3"]))
|
||||
// .then(test_node_version("v8.11.3"))
|
||||
// });
|
||||
// }
|
||||
|
||||
mod exec { |
||||
test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(WriteFile::new(".nvmrc", "v8.10.0")) |
||||
.then(Call::new("fnm", vec!["install"])) |
||||
.then(Call::new("fnm", vec!["install", "v6.10.0"])) |
||||
.then(Call::new("fnm", vec!["install", "v10.10.0"])) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["exec", "--", "node", "-v"]), |
||||
"v8.10.0", |
||||
"version file exec", |
||||
)) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["exec", "--using=6", "--", "node", "-v"]), |
||||
"v6.10.0", |
||||
"exec:6 node -v", |
||||
)) |
||||
.then(ExpectCommandOutput::new( |
||||
Call::new("fnm", vec!["exec", "--using=10", "--", "node", "-v"]), |
||||
"v10.10.0", |
||||
"exec:6 node -v", |
||||
)) |
||||
}); |
||||
} |
||||
|
||||
mod existing_installation { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "v8.11.3"])) |
||||
.then(OutputContains::new( |
||||
IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["install", "v8.11.3"]))), |
||||
"already installed", |
||||
)) |
||||
}); |
||||
} |
||||
|
||||
mod system_node { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; |path: &std::path::Path| { |
||||
use std::io::Write; |
||||
let custom_node_dir = path.join("bin"); |
||||
std::fs::create_dir(&custom_node_dir).unwrap(); |
||||
std::fs::write(custom_node_dir.join("node.cmd"), b"echo custom node").unwrap(); |
||||
let mut f = std::fs::File::create(custom_node_dir.join("node")).unwrap(); |
||||
#[cfg(unix)] |
||||
{ |
||||
use std::os::unix::fs::PermissionsExt; |
||||
let mut permissions = f.metadata().unwrap().permissions(); |
||||
permissions.set_mode(0o766); |
||||
f.set_permissions(permissions).expect("Can't set file permissions"); |
||||
} |
||||
writeln!(f, "#!/bin/sh").expect("Can't write file"); |
||||
writeln!(f, r#"echo "custom node""#).expect("Can't write file"); |
||||
|
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "10"])) |
||||
.then(Call::new("fnm", vec!["use", "10"])) |
||||
.then(Call::new("fnm", vec!["use", "system"])) |
||||
.then(test_node_version("custom node")) |
||||
}); |
||||
} |
||||
|
||||
mod use_nvmrc_lts { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(WriteFile::new(".nvmrc", "lts/dubnium")) |
||||
.then(Call::new("fnm", vec!["install"])) |
||||
.then(Call::new("fnm", vec!["use"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "lts-dubnium")) |
||||
}); |
||||
} |
||||
|
||||
mod partial_semver { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "6"])) // unsupported version, no new versions should be issued
|
||||
.then(Call::new("fnm", vec!["use", "6"])) |
||||
.then(test_node_version("v6.17.1")) |
||||
}); |
||||
} |
||||
|
||||
mod log_level_quiet { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.log_level(Some("quiet")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["install", "v8.11.3"]), "", "fnm install")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["use", "v8.11.3"]), "", "fnm use")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["alias", "v8.11.3", "something"]), "", "fnm alias")) |
||||
}); |
||||
} |
||||
|
||||
mod log_level_error { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.log_level(Some("error")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["install", "v8.11.3"]).then(Call::new("echo", vec!["empty"])), "empty", "fnm install")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["use", "v8.11.3"]).then(Call::new("echo", vec!["empty"])), "empty", "fnm use")) |
||||
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["alias", "v8.11.3", "something"]).then(Call::new("echo", vec!["empty"])), "empty", "fnm alias")) |
||||
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["alias", "abcd", "efg"]))), "Can't find requested version")) |
||||
}); |
||||
} |
||||
|
||||
mod list_local_with_nothing_installed { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["ls"])) |
||||
}); |
||||
} |
||||
|
||||
mod latest_lts { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "--lts"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "lts-latest")) |
||||
.then(Call::new("fnm", vec!["use", "'lts/*'"])) |
||||
}); |
||||
} |
||||
|
||||
mod matching_dotfiles { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; { |
||||
EvalFnmEnv::default() |
||||
.then(WriteFile::new(".nvmrc", "11.10.0")) |
||||
.then(WriteFile::new(".node-version", "11.10.0")) |
||||
.then(Call::new("fnm", vec!["install"])) |
||||
.then(Call::new("fnm", vec!["use"])) |
||||
.then(test_node_version("v11.10.0")) |
||||
}); |
||||
} |
||||
|
||||
mod use_alias_install_if_missing { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(WriteFile::new(".node-version", "lts/*")) |
||||
.then(Call::new("fnm", vec!["use", "--install-if-missing"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "lts-latest")) |
||||
}); |
||||
} |
||||
|
||||
mod use_alias_not_installed { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.log_level(Some("error")) |
||||
.then(WriteFile::new(".node-version", "lts/*")) |
||||
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["use"]))),"Requested version lts-latest is not currently installed")) |
||||
}); |
||||
} |
||||
|
||||
mod unalias { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["install", "11.10.0"])) |
||||
.then(Call::new("fnm", vec!["install", "8.11.3"])) |
||||
.then(Call::new("fnm", vec!["alias", "8.11.3", "version8"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "version8")) |
||||
.then(Call::new("fnm", vec!["unalias", "version8"])) |
||||
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["use", "version8"]))), "Requested version version8 is not currently installed")) |
||||
}); |
||||
} |
||||
|
||||
mod unalias_error { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.log_level(Some("error")) |
||||
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["unalias", "lts"]))), "Requested alias lts not found")) |
||||
}); |
||||
} |
||||
|
||||
mod alias_system { |
||||
test_shell!(Bash, Zsh, Fish, PowerShell; { |
||||
EvalFnmEnv::default() |
||||
.then(Call::new("fnm", vec!["alias", "system", "my_system"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "my_system")) |
||||
.then(Call::new("fnm", vec!["alias", "system", "default"])) |
||||
.then(Call::new("fnm", vec!["alias", "my_system", "my_system2"])) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "my_system2")) |
||||
.then(OutputContains::new(Call::new("fnm", vec!["use", "my_system"]), "Bypassing fnm")) |
||||
.then(Call::new("fnm", vec!["unalias", "my_system"])) |
||||
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["use", "my_system"]))), "Requested version my_system is not currently installed")) |
||||
}); |
||||
} |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
|
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm alias system my_system |
||||
fnm ls | grep my_system |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
fnm ls | grep my_system2 |
||||
fnm use my_system | grep 'Bypassing fnm' |
||||
fnm unalias my_system |
||||
fnm use my_system 2>&1 | grep 'Requested version my_system is not currently installed' |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
|
||||
--- |
||||
fnm env | source |
||||
fnm alias system my_system |
||||
fnm ls | grep my_system |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
fnm ls | grep my_system2 |
||||
fnm use my_system | grep 'Bypassing fnm' |
||||
fnm unalias my_system |
||||
fnm use my_system 2>&1 | grep 'Requested version my_system is not currently installed' |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
|
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm alias system my_system |
||||
$($__out__ = $(fnm ls | Select-String 'my_system'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
$($__out__ = $(fnm ls | Select-String 'my_system2'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
$($__out__ = $(fnm use my_system | Select-String 'Bypassing fnm'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
fnm unalias my_system |
||||
$($__out__ = $($($_tmp_err_action = $ErrorActionPreference;$ErrorActionPreference = "Continue";fnm use my_system 2>&1;$ErrorActionPreference = $_tmp_err_action) | Select-String 'Requested version my_system is not currently installed'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
|
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm alias system my_system |
||||
fnm ls | grep my_system |
||||
fnm alias system default |
||||
fnm alias my_system my_system2 |
||||
fnm ls | grep my_system2 |
||||
fnm use my_system | grep 'Bypassing fnm' |
||||
fnm unalias my_system |
||||
fnm use my_system 2>&1 | grep 'Requested version my_system is not currently installed' |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/aliases.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
fnm ls | grep 8.11.3 | grep oldie |
||||
fnm ls | grep 6.11.3 | grep older | grep default |
||||
fnm use older |
||||
if [ "$(node -v)" != "v6.11.3" ]; then |
||||
echo 'Expected Node version to be "v6.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use oldie |
||||
if [ "$(node -v)" != "v8.11.3" ]; then |
||||
echo 'Expected Node version to be "v8.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use default |
||||
if [ "$(node -v)" != "v6.11.3" ]; then |
||||
echo 'Expected Node version to be "v6.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/aliases.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
fnm ls | grep 8.11.3 | grep oldie |
||||
fnm ls | grep 6.11.3 | grep older | grep default |
||||
fnm use older |
||||
if test (node -v) != "v6.11.3" |
||||
echo 'Expected Node version to be "v6.11.3", Got: '(node -v) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm use oldie |
||||
if test (node -v) != "v8.11.3" |
||||
echo 'Expected Node version to be "v8.11.3", Got: '(node -v) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm use default |
||||
if test (node -v) != "v6.11.3" |
||||
echo 'Expected Node version to be "v6.11.3", Got: '(node -v) |
||||
exit 1 |
||||
end |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/aliases.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
$($__out__ = $($($__out__ = $(fnm ls | Select-String '8.11.3'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) | Select-String 'oldie'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
$($__out__ = $($($__out__ = $($($__out__ = $(fnm ls | Select-String '6.11.3'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) | Select-String 'older'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) | Select-String 'default'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
fnm use older |
||||
If ("$(node -v)" -ne "v6.11.3") { |
||||
Write-Output ('Expected Node version to be "v6.11.3", Got: ' + $(node -v)) |
||||
exit 1 |
||||
} |
||||
|
||||
fnm use oldie |
||||
If ("$(node -v)" -ne "v8.11.3") { |
||||
Write-Output ('Expected Node version to be "v8.11.3", Got: ' + $(node -v)) |
||||
exit 1 |
||||
} |
||||
|
||||
fnm use default |
||||
If ("$(node -v)" -ne "v6.11.3") { |
||||
Write-Output ('Expected Node version to be "v6.11.3", Got: ' + $(node -v)) |
||||
exit 1 |
||||
} |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/aliases.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm install 6.11.3 |
||||
fnm install 8.11.3 |
||||
fnm alias 8.11 oldie |
||||
fnm alias 6 older |
||||
fnm default older |
||||
fnm ls | grep 8.11.3 | grep oldie |
||||
fnm ls | grep 6.11.3 | grep older | grep default |
||||
fnm use older |
||||
if [ "$(node -v)" != "v6.11.3" ]; then |
||||
echo 'Expected Node version to be "v6.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use oldie |
||||
if [ "$(node -v)" != "v8.11.3" ]; then |
||||
echo 'Expected Node version to be "v8.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use default |
||||
if [ "$(node -v)" != "v6.11.3" ]; then |
||||
echo 'Expected Node version to be "v6.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if [ "$(node -v)" != "v8.11.3" ]; then |
||||
echo 'Expected Node version to be "v8.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if test (node -v) != "v8.11.3" |
||||
echo 'Expected Node version to be "v8.11.3", Got: '(node -v) |
||||
exit 1 |
||||
end |
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
If ("$(node -v)" -ne "v8.11.3") { |
||||
Write-Output ('Expected Node version to be "v8.11.3", Got: ' + $(node -v)) |
||||
exit 1 |
||||
} |
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
FOR /f "tokens=*" %i IN ('fnm env') DO CALL %i |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
node -v | findstr v8.11.3 |
||||
if %errorlevel% neq 0 ( |
||||
echo Node version does not match "v8.11.3" |
||||
exit 1 |
||||
) |
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm use v8.11.3 |
||||
if [ "$(node -v)" != "v8.11.3" ]; then |
||||
echo 'Expected Node version to be "v8.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/current.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
if [ "$(fnm current)" != "none" ]; then |
||||
echo 'Expected currently activated version to be "none", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if [ "$(fnm current)" != "v8.11.3" ]; then |
||||
echo 'Expected currently activated version to be "v8.11.3", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use v10.10.0 |
||||
if [ "$(fnm current)" != "v10.10.0" ]; then |
||||
echo 'Expected currently activated version to be "v10.10.0", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use system |
||||
if [ "$(fnm current)" != "system" ]; then |
||||
echo 'Expected currently activated version to be "system", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/current.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
if test (fnm current) != "none" |
||||
echo 'Expected currently activated version to be "none", Got: '(fnm current) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if test (fnm current) != "v8.11.3" |
||||
echo 'Expected currently activated version to be "v8.11.3", Got: '(fnm current) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm use v10.10.0 |
||||
if test (fnm current) != "v10.10.0" |
||||
echo 'Expected currently activated version to be "v10.10.0", Got: '(fnm current) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm use system |
||||
if test (fnm current) != "system" |
||||
echo 'Expected currently activated version to be "system", Got: '(fnm current) |
||||
exit 1 |
||||
end |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/current.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
If ("$(fnm current)" -ne "none") { |
||||
Write-Output ('Expected currently activated version to be "none", Got: ' + $(fnm current)) |
||||
exit 1 |
||||
} |
||||
|
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
If ("$(fnm current)" -ne "v8.11.3") { |
||||
Write-Output ('Expected currently activated version to be "v8.11.3", Got: ' + $(fnm current)) |
||||
exit 1 |
||||
} |
||||
|
||||
fnm use v10.10.0 |
||||
If ("$(fnm current)" -ne "v10.10.0") { |
||||
Write-Output ('Expected currently activated version to be "v10.10.0", Got: ' + $(fnm current)) |
||||
exit 1 |
||||
} |
||||
|
||||
fnm use system |
||||
If ("$(fnm current)" -ne "system") { |
||||
Write-Output ('Expected currently activated version to be "system", Got: ' + $(fnm current)) |
||||
exit 1 |
||||
} |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/current.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
FOR /f "tokens=*" %i IN ('fnm env') DO CALL %i |
||||
fnm current | findstr none |
||||
if %errorlevel% neq 0 ( |
||||
echo currently activated version does not match "none" |
||||
exit 1 |
||||
) |
||||
|
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
fnm current | findstr v8.11.3 |
||||
if %errorlevel% neq 0 ( |
||||
echo currently activated version does not match "v8.11.3" |
||||
exit 1 |
||||
) |
||||
|
||||
fnm use v10.10.0 |
||||
fnm current | findstr v10.10.0 |
||||
if %errorlevel% neq 0 ( |
||||
echo currently activated version does not match "v10.10.0" |
||||
exit 1 |
||||
) |
||||
|
||||
fnm use system |
||||
fnm current | findstr system |
||||
if %errorlevel% neq 0 ( |
||||
echo currently activated version does not match "system" |
||||
exit 1 |
||||
) |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/current.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
if [ "$(fnm current)" != "none" ]; then |
||||
echo 'Expected currently activated version to be "none", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm install v8.11.3 |
||||
fnm install v10.10.0 |
||||
fnm use v8.11.3 |
||||
if [ "$(fnm current)" != "v8.11.3" ]; then |
||||
echo 'Expected currently activated version to be "v8.11.3", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use v10.10.0 |
||||
if [ "$(fnm current)" != "v10.10.0" ]; then |
||||
echo 'Expected currently activated version to be "v10.10.0", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm use system |
||||
if [ "$(fnm current)" != "system" ]; then |
||||
echo 'Expected currently activated version to be "system", Got: '"$(fnm current)" |
||||
exit 1 |
||||
fi |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
echo v8.10.0 > .nvmrc |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if [ "$(fnm exec -- node -v)" != "v8.10.0" ]; then |
||||
echo 'Expected version file exec to be "v8.10.0", Got: '"$(fnm exec -- node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm exec --using=6 -- node -v)" != "v6.10.0" ]; then |
||||
echo 'Expected exec:6 node -v to be "v6.10.0", Got: '"$(fnm exec --using=6 -- node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm exec --using=10 -- node -v)" != "v10.10.0" ]; then |
||||
echo 'Expected exec:6 node -v to be "v10.10.0", Got: '"$(fnm exec --using=10 -- node -v)" |
||||
exit 1 |
||||
fi |
@ -1,23 +0,0 @@
@@ -1,23 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
echo v8.10.0 > .nvmrc |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if test (fnm exec -- node -v) != "v8.10.0" |
||||
echo 'Expected version file exec to be "v8.10.0", Got: '(fnm exec -- node -v) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm exec --using=6 -- node -v) != "v6.10.0" |
||||
echo 'Expected exec:6 node -v to be "v6.10.0", Got: '(fnm exec --using=6 -- node -v) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm exec --using=10 -- node -v) != "v10.10.0" |
||||
echo 'Expected exec:6 node -v to be "v10.10.0", Got: '(fnm exec --using=10 -- node -v) |
||||
exit 1 |
||||
end |
@ -1,24 +0,0 @@
@@ -1,24 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
echo 'v8.10.0' > '.nvmrc' |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
If ("$(fnm exec -- node -v)" -ne "v8.10.0") { |
||||
Write-Output ('Expected version file exec to be "v8.10.0", Got: ' + $(fnm exec -- node -v)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm exec --using=6 -- node -v)" -ne "v6.10.0") { |
||||
Write-Output ('Expected exec:6 node -v to be "v6.10.0", Got: ' + $(fnm exec --using=6 -- node -v)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm exec --using=10 -- node -v)" -ne "v10.10.0") { |
||||
Write-Output ('Expected exec:6 node -v to be "v10.10.0", Got: ' + $(fnm exec --using=10 -- node -v)) |
||||
exit 1 |
||||
} |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
FOR /f "tokens=*" %i IN ('fnm env') DO CALL %i |
||||
echo v8.10.0 > .nvmrc |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
fnm exec -- node -v | findstr v8.10.0 |
||||
if %errorlevel% neq 0 ( |
||||
echo version file exec does not match "v8.10.0" |
||||
exit 1 |
||||
) |
||||
|
||||
fnm exec --using=6 -- node -v | findstr v6.10.0 |
||||
if %errorlevel% neq 0 ( |
||||
echo exec:6 node -v does not match "v6.10.0" |
||||
exit 1 |
||||
) |
||||
|
||||
fnm exec --using=10 -- node -v | findstr v10.10.0 |
||||
if %errorlevel% neq 0 ( |
||||
echo exec:6 node -v does not match "v10.10.0" |
||||
exit 1 |
||||
) |
@ -1,24 +0,0 @@
@@ -1,24 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
echo v8.10.0 > .nvmrc |
||||
fnm install |
||||
fnm install v6.10.0 |
||||
fnm install v10.10.0 |
||||
if [ "$(fnm exec -- node -v)" != "v8.10.0" ]; then |
||||
echo 'Expected version file exec to be "v8.10.0", Got: '"$(fnm exec -- node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm exec --using=6 -- node -v)" != "v6.10.0" ]; then |
||||
echo 'Expected exec:6 node -v to be "v6.10.0", Got: '"$(fnm exec --using=6 -- node -v)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm exec --using=10 -- node -v)" != "v10.10.0" ]; then |
||||
echo 'Expected exec:6 node -v to be "v10.10.0", Got: '"$(fnm exec --using=10 -- node -v)" |
||||
exit 1 |
||||
fi |
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm install v8.11.3 2>&1 | grep 'already installed' |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm install v8.11.3 |
||||
fnm install v8.11.3 2>&1 | grep 'already installed' |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install v8.11.3 |
||||
$($__out__ = $($($_tmp_err_action = $ErrorActionPreference;$ErrorActionPreference = "Continue";fnm install v8.11.3 2>&1;$ErrorActionPreference = $_tmp_err_action) | Select-String 'already installed'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm install v8.11.3 2>&1 | grep 'already installed' |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm install --lts |
||||
fnm ls | grep lts-latest |
||||
fnm use 'lts/*' |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm install --lts |
||||
fnm ls | grep lts-latest |
||||
fnm use 'lts/*' |
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm install --lts |
||||
$($__out__ = $(fnm ls | Select-String 'lts-latest'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
||||
fnm use 'lts/*' |
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm install --lts |
||||
fnm ls | grep lts-latest |
||||
fnm use 'lts/*' |
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm ls |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm ls |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
fnm ls |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
FOR /f "tokens=*" %i IN ('fnm env') DO CALL %i |
||||
fnm ls |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
fnm ls |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm --log-level='error' env)" |
||||
if [ "$(fnm install v8.11.3 |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm install to be "empty", Got: '"$(fnm install v8.11.3 |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm use v8.11.3 |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm use to be "empty", Got: '"$(fnm use v8.11.3 |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm alias v8.11.3 something |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm alias to be "empty", Got: '"$(fnm alias v8.11.3 something |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm alias abcd efg 2>&1 | grep 'Can'\''t find requested version' |
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm --log-level='error' env | source |
||||
if test (fnm install v8.11.3 |
||||
echo empty) != "empty" |
||||
echo 'Expected fnm install to be "empty", Got: '(fnm install v8.11.3 |
||||
echo empty) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm use v8.11.3 |
||||
echo empty) != "empty" |
||||
echo 'Expected fnm use to be "empty", Got: '(fnm use v8.11.3 |
||||
echo empty) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm alias v8.11.3 something |
||||
echo empty) != "empty" |
||||
echo 'Expected fnm alias to be "empty", Got: '(fnm alias v8.11.3 something |
||||
echo empty) |
||||
exit 1 |
||||
end |
||||
|
||||
fnm alias abcd efg 2>&1 | grep 'Can'\''t find requested version' |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm --log-level='error' env | Out-String | Invoke-Expression |
||||
If ("$(fnm install v8.11.3 |
||||
echo empty)" -ne "empty") { |
||||
Write-Output ('Expected fnm install to be "empty", Got: ' + $(fnm install v8.11.3 |
||||
echo empty)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm use v8.11.3 |
||||
echo empty)" -ne "empty") { |
||||
Write-Output ('Expected fnm use to be "empty", Got: ' + $(fnm use v8.11.3 |
||||
echo empty)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm alias v8.11.3 something |
||||
echo empty)" -ne "empty") { |
||||
Write-Output ('Expected fnm alias to be "empty", Got: ' + $(fnm alias v8.11.3 something |
||||
echo empty)) |
||||
exit 1 |
||||
} |
||||
|
||||
$($__out__ = $($($_tmp_err_action = $ErrorActionPreference;$ErrorActionPreference = "Continue";fnm alias abcd efg 2>&1;$ErrorActionPreference = $_tmp_err_action) | Select-String 'Can''t find requested version'); echo $__out__; if ($__out__ -eq $null){ exit 1 } else { $__out__ }) |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm --log-level='error' env)" |
||||
if [ "$(fnm install v8.11.3 |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm install to be "empty", Got: '"$(fnm install v8.11.3 |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm use v8.11.3 |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm use to be "empty", Got: '"$(fnm use v8.11.3 |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm alias v8.11.3 something |
||||
echo empty)" != "empty" ]; then |
||||
echo 'Expected fnm alias to be "empty", Got: '"$(fnm alias v8.11.3 something |
||||
echo empty)" |
||||
exit 1 |
||||
fi |
||||
|
||||
fnm alias abcd efg 2>&1 | grep 'Can'\''t find requested version' |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm --log-level='quiet' env)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo 'Expected fnm install to be "", Got: '"$(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo 'Expected fnm use to be "", Got: '"$(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo 'Expected fnm alias to be "", Got: '"$(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi |
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm --log-level='quiet' env | source |
||||
if test (fnm install v8.11.3) != "" |
||||
echo 'Expected fnm install to be "", Got: '(fnm install v8.11.3) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm use v8.11.3) != "" |
||||
echo 'Expected fnm use to be "", Got: '(fnm use v8.11.3) |
||||
exit 1 |
||||
end |
||||
|
||||
if test (fnm alias v8.11.3 something) != "" |
||||
echo 'Expected fnm alias to be "", Got: '(fnm alias v8.11.3 something) |
||||
exit 1 |
||||
end |
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm --log-level='quiet' env | Out-String | Invoke-Expression |
||||
If ("$(fnm install v8.11.3)" -ne "") { |
||||
Write-Output ('Expected fnm install to be "", Got: ' + $(fnm install v8.11.3)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm use v8.11.3)" -ne "") { |
||||
Write-Output ('Expected fnm use to be "", Got: ' + $(fnm use v8.11.3)) |
||||
exit 1 |
||||
} |
||||
|
||||
If ("$(fnm alias v8.11.3 something)" -ne "") { |
||||
Write-Output ('Expected fnm alias to be "", Got: ' + $(fnm alias v8.11.3 something)) |
||||
exit 1 |
||||
} |
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm --log-level='quiet' env)" |
||||
if [ "$(fnm install v8.11.3)" != "" ]; then |
||||
echo 'Expected fnm install to be "", Got: '"$(fnm install v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm use v8.11.3)" != "" ]; then |
||||
echo 'Expected fnm use to be "", Got: '"$(fnm use v8.11.3)" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ "$(fnm alias v8.11.3 something)" != "" ]; then |
||||
echo 'Expected fnm alias to be "", Got: '"$(fnm alias v8.11.3 something)" |
||||
exit 1 |
||||
fi |
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
echo 11.10.0 > .nvmrc |
||||
echo 11.10.0 > .node-version |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node -v)" != "v11.10.0" ]; then |
||||
echo 'Expected Node version to be "v11.10.0", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
echo 11.10.0 > .nvmrc |
||||
echo 11.10.0 > .node-version |
||||
fnm install |
||||
fnm use |
||||
if test (node -v) != "v11.10.0" |
||||
echo 'Expected Node version to be "v11.10.0", Got: '(node -v) |
||||
exit 1 |
||||
end |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
$ErrorActionPreference = "Stop" |
||||
fnm env | Out-String | Invoke-Expression |
||||
echo '11.10.0' > '.nvmrc' |
||||
echo '11.10.0' > '.node-version' |
||||
fnm install |
||||
fnm use |
||||
If ("$(node -v)" -ne "v11.10.0") { |
||||
Write-Output ('Expected Node version to be "v11.10.0", Got: ' + $(node -v)) |
||||
exit 1 |
||||
} |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
FOR /f "tokens=*" %i IN ('fnm env') DO CALL %i |
||||
echo 11.10.0 > .nvmrc |
||||
echo 11.10.0 > .node-version |
||||
fnm install |
||||
fnm use |
||||
node -v | findstr v11.10.0 |
||||
if %errorlevel% neq 0 ( |
||||
echo Node version does not match "v11.10.0" |
||||
exit 1 |
||||
) |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
eval "$(fnm env)" |
||||
echo 11.10.0 > .nvmrc |
||||
echo 11.10.0 > .node-version |
||||
fnm install |
||||
fnm use |
||||
if [ "$(node -v)" != "v11.10.0" ]; then |
||||
echo 'Expected Node version to be "v11.10.0", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
fnm use v8.11.3 |
||||
echo 'set -e |
||||
shopt -s expand_aliases |
||||
|
||||
eval "$(fnm env)" |
||||
fnm use 11 |
||||
if [ "$(node -v)" '\!'= "v11.9.0" ]; then |
||||
echo '\''Expected Node version to be "v11.9.0", Got: '\''"$(node -v)" |
||||
exit 1 |
||||
fi |
||||
' | bash |
||||
if [ "$(node -v)" != "v8.11.3" ]; then |
||||
echo 'Expected Node version to be "v8.11.3", Got: '"$(node -v)" |
||||
exit 1 |
||||
fi |
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
--- |
||||
source: tests/feature_tests/mod.rs |
||||
expression: "&source.trim()" |
||||
--- |
||||
fnm env | source |
||||
fnm install v8.11.3 |
||||
fnm install v11.9.0 |
||||
fnm use v8.11.3 |
||||
fish -c ' |
||||
fnm env | source |
||||
fnm use 11 |
||||
if test (node -v) '\!'= "v11.9.0" |
||||
echo '\''Expected Node version to be "v11.9.0", Got: '\''(node -v) |
||||
exit 1 |
||||
end |
||||
' |
||||
if test (node -v) != "v8.11.3" |
||||
echo 'Expected Node version to be "v8.11.3", Got: '(node -v) |
||||
exit 1 |
||||
end |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue