Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(test): wait for item content in switch picker PTY tests (#1066)
worktrunk-botf5c4629ef01d
diff --git a/src/commands/handle_switch.rs b/src/commands/handle_switch.rsindex 4d6738311..427e86431 100644--- a/src/commands/handle_switch.rs+++ b/src/commands/handle_switch.rs@@ -151,7 +151,7 @@ pub fn handle_switch(// Without this, errors like "branch already exists" would suggest `wt switch <branch>`// instead of the full `wt switch <branch> --execute=<cmd> -- <args>`.let suggestion_ctx = execute.map(|exec| {- let escaped = shlex::try_quote(exec).unwrap_or(exec.into());+ let escaped = shell_escape::escape(exec.into());SwitchSuggestionCtx {extra_flags: vec![format!("--execute={escaped}")],trailing_args: execute_args.to_vec(),diff --git a/src/git/error.rs b/src/git/error.rsindex a44faaf22..f77ea4bdf 100644--- a/src/git/error.rs+++ b/src/git/error.rs@@ -126,7 +126,7 @@ impl SwitchSuggestionCtx {/// separator when this context is applied.fn apply(&self, cmd: String) -> String {let mut result = cmd;- // Flags are pre-escaped at construction (handle_switch.rs uses shlex::try_quote)+ // Flags are pre-escaped at construction (handle_switch.rs uses shell_escape)for flag in &self.extra_flags {result.push(' ');result.push_str(flag);diff --git a/tests/integration_tests/switch_picker.rs b/tests/integration_tests/switch_picker.rsindex 8c8cf4b22..f1fef2cb1 100644--- a/tests/integration_tests/switch_picker.rs+++ b/tests/integration_tests/switch_picker.rs@@ -508,7 +508,8 @@ fn test_switch_picker_with_multiple_worktrees(mut repo: TestRepo) {&["switch"],repo.root_path(),&env_vars,- &[], // No inputs before abort+ // Wait for items to render before capturing (prevents flakiness on slow CI)+ &[("", Some("feature-two"))],);assert_valid_abort_exit_code(result.exit_code);@@ -542,7 +543,10 @@ fn test_switch_picker_with_branches(mut repo: TestRepo) {&["switch", "--branches"],repo.root_path(),&env_vars,- &[], // No inputs before abort+ // Wait for branch items to render before capturing. On macOS CI under+ // heavy load, skim may show the prompt and header before item rows,+ // causing wait_for_stable to capture too early (just the header).+ &[("", Some("orphan-branch"))],);assert_valid_abort_exit_code(result.exit_code);