From 86f9aa9439d12ef9aa400ce2dbadeb8f661cb686 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Tue, 3 Dec 2024 15:05:04 -0800 Subject: [PATCH] Update tests. --- .yarn/versions/af8209b2.yml | 24 ++-- CHANGELOG.md | 2 + ..._errors_when_parsing_custom_var_types.snap | 4 +- crates/config/tests/toolchain_config_test.rs | 107 +++++++++++++++++- 4 files changed, 120 insertions(+), 17 deletions(-) diff --git a/.yarn/versions/af8209b2.yml b/.yarn/versions/af8209b2.yml index 1dbe1705cd3..462d5dd6f3c 100644 --- a/.yarn/versions/af8209b2.yml +++ b/.yarn/versions/af8209b2.yml @@ -1,12 +1,16 @@ releases: - "@moonrepo/cli": patch - "@moonrepo/core-linux-arm64-gnu": patch - "@moonrepo/core-linux-arm64-musl": patch - "@moonrepo/core-linux-x64-gnu": patch - "@moonrepo/core-linux-x64-musl": patch - "@moonrepo/core-macos-arm64": patch - "@moonrepo/core-macos-x64": patch - "@moonrepo/core-windows-x64-msvc": patch + '@moonrepo/cli': patch + '@moonrepo/core-linux-arm64-gnu': patch + '@moonrepo/core-linux-arm64-musl': patch + '@moonrepo/core-linux-x64-gnu': patch + '@moonrepo/core-linux-x64-musl': patch + '@moonrepo/core-macos-arm64': patch + '@moonrepo/core-macos-x64': patch + '@moonrepo/core-windows-x64-msvc': patch + '@moonrepo/types': patch -undecided: - - "@moonrepo/types" +declined: + - '@moonrepo/nx-compat' + - '@moonrepo/report' + - '@moonrepo/runtime' + - website diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e3d9f54818..43073d45934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ #### ⚙️ Internal - Updated proto to v0.43.0 (from 0.42.2). +- Updated wasmtime to v26 (from v23). +- Updated Rust to v1.83. ## 1.30.2 diff --git a/crates/cli/tests/snapshots/generate_test__errors_when_parsing_custom_var_types.snap b/crates/cli/tests/snapshots/generate_test__errors_when_parsing_custom_var_types.snap index d871b602dac..b36a4c05c31 100644 --- a/crates/cli/tests/snapshots/generate_test__errors_when_parsing_custom_var_types.snap +++ b/crates/cli/tests/snapshots/generate_test__errors_when_parsing_custom_var_types.snap @@ -8,5 +8,5 @@ A template for testing all variable config combinations. Error: codegen::args::parse_failed × Failed to parse variables from arguments. - ╰─▶ × invalid value 'abc' for '--number ': invalid digit found - in string + ╰─▶ × invalid value 'abc' for '--number ': invalid digit found in + │ string diff --git a/crates/config/tests/toolchain_config_test.rs b/crates/config/tests/toolchain_config_test.rs index 19562ab1fdc..08f2b834bab 100644 --- a/crates/config/tests/toolchain_config_test.rs +++ b/crates/config/tests/toolchain_config_test.rs @@ -635,7 +635,7 @@ node: assert_eq!( config.node.unwrap().npm.plugin.unwrap(), PluginLocator::Url(Box::new(UrlLocator { - url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.0/node_depman_tool.wasm".into() + url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.1/node_depman_tool.wasm".into() })) ); } @@ -727,7 +727,7 @@ node: assert_eq!( config.node.unwrap().pnpm.unwrap().plugin.unwrap(), PluginLocator::Url(Box::new(UrlLocator { - url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.0/node_depman_tool.wasm".into() + url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.1/node_depman_tool.wasm".into() })) ); } @@ -751,7 +751,7 @@ node: assert_eq!( config.node.unwrap().pnpm.unwrap().plugin.unwrap(), PluginLocator::Url(Box::new(UrlLocator { - url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.0/node_depman_tool.wasm".into() + url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.1/node_depman_tool.wasm".into() })) ); } @@ -853,7 +853,7 @@ node: assert_eq!( config.node.unwrap().yarn.unwrap().plugin.unwrap(), PluginLocator::Url(Box::new(UrlLocator { - url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.0/node_depman_tool.wasm".into() + url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.1/node_depman_tool.wasm".into() })) ); } @@ -877,7 +877,7 @@ node: assert_eq!( config.node.unwrap().yarn.unwrap().plugin.unwrap(), PluginLocator::Url(Box::new(UrlLocator { - url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.0/node_depman_tool.wasm".into() + url: "https://github.com/moonrepo/tools/releases/download/node_depman_tool-v0.14.1/node_depman_tool.wasm".into() })) ); } @@ -1134,6 +1134,103 @@ node: } } + mod python { + use super::*; + + #[test] + fn enables_via_proto() { + let config = test_load_config(FILENAME, "{}", |path| { + let mut proto = ProtoConfig::default(); + proto.versions.insert( + Id::raw("python"), + UnresolvedVersionSpec::parse("1.0.0").unwrap(), + ); + + load_config_from_root(path, &proto) + }); + + assert!(config.python.is_some()); + assert_eq!( + config.python.unwrap().version.unwrap(), + UnresolvedVersionSpec::parse("1.0.0").unwrap() + ); + } + + #[test] + fn inherits_plugin_locator() { + let config = test_load_config(FILENAME, "python: {}", |path| { + let mut tools = ProtoConfig::default(); + tools.inherit_builtin_plugins(); + + load_config_from_root(path, &tools) + }); + + assert_eq!( + config.python.unwrap().plugin.unwrap(), + PluginLocator::Url(Box::new(UrlLocator { + url: "https://github.com/moonrepo/tools/releases/download/python_tool-v0.12.1/python_tool.wasm".into() + })) + ); + } + + #[test] + #[serial] + fn proto_version_doesnt_override() { + let config = test_load_config( + FILENAME, + r" +python: + version: 1.0.0 +", + |path| { + let mut proto = ProtoConfig::default(); + proto.versions.insert( + Id::raw("python"), + UnresolvedVersionSpec::parse("2.0.0").unwrap(), + ); + + load_config_from_root(path, &proto) + }, + ); + + assert!(config.python.is_some()); + assert_eq!( + config.python.unwrap().version.unwrap(), + UnresolvedVersionSpec::parse("1.0.0").unwrap() + ); + } + + #[test] + #[serial] + fn inherits_version_from_env_var() { + env::set_var("MOON_PYTHON_VERSION", "1.0.0"); + + let config = test_load_config( + FILENAME, + r" +python: + version: 3.0.0 +", + |path| { + let mut proto = ProtoConfig::default(); + proto.versions.insert( + Id::raw("python"), + UnresolvedVersionSpec::parse("2.0.0").unwrap(), + ); + + load_config_from_root(path, &proto) + }, + ); + + env::remove_var("MOON_PYTHON_VERSION"); + + assert_eq!( + config.python.unwrap().version.unwrap(), + UnresolvedVersionSpec::parse("1.0.0").unwrap() + ); + } + } + mod rust { use super::*;