Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(test): normalize PTY blank lines in shell install tests (#499)
Maximilian Roosb6f88689b20e
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex a058f8196..73e75cd6f 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -974,6 +974,15 @@ mod pty_tests {// that appear due to PTY timing differenceslet output = regex::Regex::new(r"^[yn]\n").unwrap().replace(&output, "");+ // Normalize blank lines caused by PTY echo timing variations.+ // The newline from user input can appear at different positions relative+ // to the prompt text depending on the system. Collapse consecutive newlines+ // to a single newline, then strip any leading newline.+ let output = regex::Regex::new(r"\n{2,}")+ .unwrap()+ .replace_all(&output, "\n");+ let output = output.trim_start_matches('\n');+// Replace temp home path with ~/let home_path = temp_home.path().to_string_lossy();output.replace(&*home_path, "~").to_string()diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snapindex eb6db1bb6..d763e4b33 100644--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap@@ -2,6 +2,5 @@source: tests/integration_tests/configure_shell.rsexpression: normalized----[36m❯[39m Install shell integration? [1m[y/N/?][22m✗ Cancelled by userdiff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snapindex 95a228bde..de660625a 100644--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap@@ -2,12 +2,10 @@source: tests/integration_tests/configure_shell.rsexpression: normalized----[36m❯[39m Install shell integration? [1m[y/N/?][22m✓ Added shell extension & completions for zsh @ ~/.zshrc↳ Skipped bash; ~/.bashrc not found↳ Skipped fish; ~/.config/fish/conf.d not found-✓ Configured 1 shell▲ Completions require compinit; add to ~/.zshrc before the wt line:autoload -Uz compinit && compinit