dev-util/fnm: new package, add 1.31.0

Signed-off-by: Alexey Zapparov <alexey@zapparov.com>
This commit is contained in:
Alexey Zapparov
2022-06-24 22:05:09 +02:00
parent 65b353adee
commit baa196d22c
5 changed files with 997 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ log = "0.4.14"
env_logger = "0.9.0"
atty = "0.2.14"
encoding_rs_io = "0.1.7"
-reqwest = { git = "https://github.com/seanmonstar/reqwest.git", rev = "d92d2aa3ce4667faa38454c8dae4fa9f72b91b71", features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots", "brotli"], default-features = false }
+reqwest = { path = @@REQWEST_PATH@@, features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots", "brotli"], default-features = false }
url = "2.2.2"
sysinfo = "0.23.2"
thiserror = "1.0.30"

View File

@@ -0,0 +1,211 @@
--- a/tests/feature_tests/aliases.rs
+++ b/tests/feature_tests/aliases.rs
@@ -4,7 +4,7 @@ fn installed_versions() -> Call {
Call::new("fnm", vec!["ls"])
}
-test_shell!(Bash, Zsh, Fish, PowerShell; {
+test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "6.11.3"]))
.then(Call::new("fnm", vec!["install", "8.11.3"]))
--- a/tests/feature_tests/current.rs
+++ b/tests/feature_tests/current.rs
@@ -1,4 +1,4 @@
-test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; {
+test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(ExpectCommandOutput::new(
Call::new("fnm", vec!["current"]),
--- a/tests/feature_tests/mod.rs
+++ b/tests/feature_tests/mod.rs
@@ -5,7 +5,7 @@ mod uninstall;
use crate::shellcode::*;
mod basic {
- test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "v8.11.3"]))
.then(Call::new("fnm", vec!["use", "v8.11.3"]))
@@ -14,7 +14,7 @@ mod basic {
}
mod nvmrc {
- test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.then(WriteFile::new(".nvmrc", "v8.11.3"))
.then(Call::new("fnm", vec!["install"]))
@@ -24,7 +24,7 @@ mod nvmrc {
}
mod multishell {
- test_shell!(Zsh, Bash, Fish, PowerShell; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "v8.11.3"]))
.then(Call::new("fnm", vec!["install", "v11.9.0"]))
@@ -40,7 +40,7 @@ mod multishell {
}
mod use_on_cd_nvmrc {
- test_shell!(Zsh, Bash, Fish, PowerShell; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.use_on_cd(true)
.then(Call::new("mkdir", vec!["inner_path"]))
@@ -52,7 +52,7 @@ mod use_on_cd_nvmrc {
}
mod use_on_cd_dot_node_version {
- test_shell!(Zsh, Bash, Fish, PowerShell; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.use_on_cd(true)
.then(Call::new("mkdir", vec!["inner_path"]))
@@ -74,7 +74,7 @@ mod use_on_cd_dot_node_version {
// }
mod exec {
- test_shell!(Zsh, Bash, Fish, PowerShell, WinCmd; {
+ test_shell!(Zsh, Bash, Fish; {
EvalFnmEnv::default()
.then(WriteFile::new(".nvmrc", "v8.10.0"))
.then(Call::new("fnm", vec!["install"]))
@@ -99,7 +99,7 @@ mod exec {
}
mod existing_installation {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "v8.11.3"]))
.then(OutputContains::new(
@@ -110,7 +110,7 @@ mod existing_installation {
}
mod system_node {
- test_shell!(Bash, Zsh, Fish, PowerShell; |path: &std::path::Path| {
+ test_shell!(Bash, Zsh, Fish; |path: &std::path::Path| {
use std::io::Write;
let custom_node_dir = path.join("bin");
std::fs::create_dir(&custom_node_dir).unwrap();
@@ -135,7 +135,7 @@ mod system_node {
}
mod use_nvmrc_lts {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(WriteFile::new(".nvmrc", "lts/dubnium"))
.then(Call::new("fnm", vec!["install"]))
@@ -145,7 +145,7 @@ mod use_nvmrc_lts {
}
mod partial_semver {
- test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "6"])) // unsupported version, no new versions should be issued
.then(Call::new("fnm", vec!["use", "6"]))
@@ -154,7 +154,7 @@ mod partial_semver {
}
mod log_level_quiet {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.log_level(Some("quiet"))
.then(ExpectCommandOutput::new(Call::new("fnm", vec!["install", "v8.11.3"]), "", "fnm install"))
@@ -164,7 +164,7 @@ mod log_level_quiet {
}
mod log_level_error {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
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"))
@@ -175,14 +175,14 @@ mod log_level_error {
}
mod list_local_with_nothing_installed {
- test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["ls"]))
});
}
mod latest_lts {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "--lts"]))
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "lts-latest"))
@@ -191,7 +191,7 @@ mod latest_lts {
}
mod matching_dotfiles {
- test_shell!(Bash, Zsh, Fish, PowerShell, WinCmd; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(WriteFile::new(".nvmrc", "11.10.0"))
.then(WriteFile::new(".node-version", "11.10.0"))
@@ -202,7 +202,7 @@ mod matching_dotfiles {
}
mod use_alias_install_if_missing {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(WriteFile::new(".node-version", "lts/*"))
.then(Call::new("fnm", vec!["use", "--install-if-missing"]))
@@ -211,7 +211,7 @@ mod use_alias_install_if_missing {
}
mod use_alias_not_installed {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.log_level(Some("error"))
.then(WriteFile::new(".node-version", "lts/*"))
@@ -220,7 +220,7 @@ mod use_alias_not_installed {
}
mod unalias {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "11.10.0"]))
.then(Call::new("fnm", vec!["install", "8.11.3"]))
@@ -232,7 +232,7 @@ mod unalias {
}
mod unalias_error {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.log_level(Some("error"))
.then(OutputContains::new(IgnoreErrors::new(GetStderr::new(Call::new("fnm", vec!["unalias", "lts"]))), "Requested alias lts not found"))
@@ -240,7 +240,7 @@ mod unalias_error {
}
mod alias_system {
- test_shell!(Bash, Zsh, Fish, PowerShell; {
+ test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["alias", "system", "my_system"]))
.then(OutputContains::new(Call::new("fnm", vec!["ls"]), "my_system"))
--- a/tests/feature_tests/uninstall.rs
+++ b/tests/feature_tests/uninstall.rs
@@ -1,7 +1,7 @@
#[allow(unused_imports)]
use crate::shellcode::*;
-test_shell!(Bash, Zsh, Fish, PowerShell; {
+test_shell!(Bash, Zsh, Fish; {
EvalFnmEnv::default()
.then(Call::new("fnm", vec!["install", "12.0.0"]))
.then(Call::new("fnm", vec!["alias", "12.0.0", "hello"]))