Skip to content

Commit

Permalink
e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 14, 2023
1 parent 13a70c6 commit 00c0414
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions e2e/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ setup_env() {
export RTX_DEFAULT_TOOL_VERSIONS_FILENAME=.e2e-tool-versions
export RTX_DEFAULT_CONFIG_FILENAME=.e2e.rtx.toml
export RTX_CONFIG_FILE="$ROOT/e2e/.config/rtx/config.toml"
export RTX_ALWAYS_KEEP_DOWNLOAD="1"
export RTX_TRUSTED_CONFIG_PATHS="$ROOT/e2e"
export RTX_YES="1"
export NPM_CONFIG_FUND="false"
Expand Down
20 changes: 5 additions & 15 deletions e2e/test_nodejs
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
#!/usr/bin/env bash
set -x
set -euo pipefail
# shellcheck source-path=SCRIPTDIR
source "$(dirname "$0")/assert.sh"

export RTX_EXPERIMENTAL=1
export RTX_NODE_BUILD=1
export RTX_NODE_COREPACK=1
export RTX_NODE_DEFAULT_PACKAGES_FILE="$ROOT/e2e/.default-npm-packages"

rtx plugin uninstall node
rtx i node node@lts/hydrogen
assert_contains "rtx x node@lts/hydrogen -- node --version" "v18."
assert "rtx x -- node --version" "v20.0.0"
assert_contains "rtx node node-build --version" "node-build "
assert_contains "rtx x -- which yarn" "yarn"

# test asdf-nodejs
rtx plugin i nodejs https://github.com/asdf-vm/asdf-nodejs.git
rtx use [email protected]
rtx ls
assert "rtx x -- node --version" "v20.1.0"
assert_contains "rtx ls-remote nodejs" "20.1.0"
assert_contains "rtx node nodebuild --version" "node-build "
rtx use --rm node

# RTX_LEGACY_VERSION_FILE env var
RTX_LEGACY_VERSION_FILE=1 assert_contains "rtx current node" "20.0.0"
RTX_LEGACY_VERSION_FILE=0 assert_not_contains "rtx current node" "20.0.0"
rtx plugin uninstall nodejs
assert_not_contains "rtx plugins --user" "node"

# disable nodejs plugin
RTX_DISABLE_TOOLS=node assert_not_contains "rtx plugins --core" "node"

export RTX_NODE_BUILD=0
rtx uninstall -a node
rtx i node
assert "rtx x -- node --version" "v20.0.0"
# rtx uninstall node
# RTX_NODE_COMPILE=1 rtx i node
# assert "rtx x -- node --version" "v20.0.0"

export RTX_NODE_COREPACK=1
rtx uninstall node
rtx i node
assert_contains "rtx x node -- which yarn" "yarn"
6 changes: 4 additions & 2 deletions src/toolset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ impl Toolset {
pub fn install_arg_versions(&mut self, config: &Config, opts: &InstallOptions) -> Result<()> {
let mpr = MultiProgressReport::new();
let versions = self
.list_missing_versions(config)
.list_current_versions()
.into_iter()
.filter(|(p, tv)| opts.force || p.is_version_installed(tv))
.map(|(_, tv)| tv)
.filter(|tv| matches!(self.versions[&tv.plugin_name].source, ToolSource::Argument))
.cloned()
.collect_vec();
debug!("install_arg_versions: {}", versions.iter().join(", "));
self.install_versions(config, versions, &mpr, opts)
}

Expand Down

0 comments on commit 00c0414

Please sign in to comment.