From 9be9467e88a356667bfb3d8d2cfa944b5f36ca1d Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Wed, 18 Dec 2024 00:01:15 -0800 Subject: [PATCH] Fix tests. --- CHANGELOG.md | 4 ++++ crates/cli/src/commands/outdated.rs | 5 ++++- crates/cli/tests/outdated_test.rs | 2 ++ crates/cli/tests/plugin_search_test.rs | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 114c66adb..334a3bffd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - Removed the `--global` option from `proto alias`, `unalias`, `pin`, and `unpin`, use `--to` or `--from` instead. +## Unreleased + +- Added a `--yes` option to `proto outdated`, that skips confirmation prompts. + ## 0.43.2 #### 🐞 Fixes diff --git a/crates/cli/src/commands/outdated.rs b/crates/cli/src/commands/outdated.rs index e9f4d95f5..3b411a61b 100644 --- a/crates/cli/src/commands/outdated.rs +++ b/crates/cli/src/commands/outdated.rs @@ -31,6 +31,9 @@ pub struct OutdatedArgs { help = "Update and write the versions to their respective configuration" )] update: bool, + + #[arg(long, help = "Avoid and force confirm prompts", env = "PROTO_YES")] + yes: bool, } #[derive(Serialize)] @@ -261,7 +264,7 @@ pub async fn outdated(session: ProtoSession, args: OutdatedArgs) -> AppResult { }) .await?; - if confirmed { + if args.yes || confirmed { let mut updates: BTreeMap> = BTreeMap::new(); for (id, item) in &items { diff --git a/crates/cli/tests/outdated_test.rs b/crates/cli/tests/outdated_test.rs index b6ed2fcff..d7c320747 100644 --- a/crates/cli/tests/outdated_test.rs +++ b/crates/cli/tests/outdated_test.rs @@ -120,6 +120,7 @@ mod outdated { .arg("--update") .arg("--config-mode") .arg("upwards-global") + .arg("--yes") .current_dir(sandbox.path().join("a/b")); }) .success(); @@ -145,6 +146,7 @@ mod outdated { .arg("--config-mode") .arg("upwards-global") .arg("--latest") + .arg("--yes") .current_dir(sandbox.path().join("a/b")); }) .success(); diff --git a/crates/cli/tests/plugin_search_test.rs b/crates/cli/tests/plugin_search_test.rs index e7fbc4a06..80ad923de 100644 --- a/crates/cli/tests/plugin_search_test.rs +++ b/crates/cli/tests/plugin_search_test.rs @@ -46,7 +46,7 @@ mod plugin_search { }) .success(); - assert.stdout(predicate::str::contains("Available for query: zig")); + assert.stdout(predicate::str::contains("Search results for: zig")); } #[test]