Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

test: Add zsh to hook-related integration tests for full parity

Maximilian Roos2ca1c776b996
diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rs
index 4130ee5c3..10230caad 100644
--- a/tests/integration_tests/shell_wrapper.rs
+++ b/tests/integration_tests/shell_wrapper.rs
@@ -462,6 +462,7 @@ mod tests {
/// Test switch --create with post-create-command (blocking) and post-start-command (background)
#[rstest]
#[case("bash")]
+ #[case("zsh")]
#[case("fish")]
fn test_wrapper_switch_with_hooks(#[case] shell: &str) {
let repo = TestRepo::new();
@@ -526,6 +527,7 @@ command = "echo 'Watching for file changes'"
/// Test merge with successful pre-merge-command validation
#[rstest]
#[case("bash")]
+ #[case("zsh")]
#[case("fish")]
fn test_wrapper_merge_with_pre_merge_success(#[case] shell: &str) {
let mut repo = TestRepo::new();
@@ -610,6 +612,7 @@ command = "echo '✓ All 47 tests passed in 2.3s'"
/// Test merge with failing pre-merge-command that aborts the merge
#[rstest]
#[case("bash")]
+ #[case("zsh")]
#[case("fish")]
fn test_wrapper_merge_with_pre_merge_failure(#[case] shell: &str) {
let mut repo = TestRepo::new();
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
new file mode 100644
index 000000000..29eac739a
--- /dev/null
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
@@ -0,0 +1,18 @@
+---
+source: tests/integration_tests/shell_wrapper.rs
+expression: output.normalized().as_ref()
+---
+zsh:365: command not found: compdef
+✓ Code formatting check passed
+✗ Test suite failed: 3 tests failing
+❌ Pre-merge command failed: test
+
+Command failed with exit code: exit status: 1
+
+💡 Use --no-hooks to skip pre-merge commands
+🔄 Running pre-merge command format:
+  echo '✓ Code formatting check passed'
+
+
+🔄 Running pre-merge command test:
+  echo '✗ Test suite failed: 3 tests failing' && exit 1
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
new file mode 100644
index 000000000..3474951f1
--- /dev/null
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
@@ -0,0 +1,32 @@
+---
+source: tests/integration_tests/shell_wrapper.rs
+expression: output.normalized().as_ref()
+---
+zsh:365: command not found: compdef
+✓ Code formatting check passed
+✓ Linting passed - no warnings
+✓ All 47 tests passed in 2.3s
+🔄 Running pre-merge command format:
+  echo '✓ Code formatting check passed'
+
+
+🔄 Running pre-merge command lint:
+  echo '✓ Linting passed - no warnings'
+
+
+🔄 Running pre-merge command test:
+  echo '✓ All 47 tests passed in 2.3s'
+
+
+🔄 Rebasing onto main...
+🔄 Merging 1 commit to main @ d067f01
+
+* d067f01 (HEAD -> feature) Add feature
+
+ feature.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+✅ Merged to main (1 commit, 1 file, +1) 
+🔄 Cleaning up worktree...
+
+✅ Returned to primary at [TMPDIR]/test-repo
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
new file mode 100644
index 000000000..408cbd06e
--- /dev/null
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
@@ -0,0 +1,22 @@
+---
+source: tests/integration_tests/shell_wrapper.rs
+expression: output.normalized().as_ref()
+---
+zsh:365: command not found: compdef
+Installing dependencies...
+Building project...
+🔄 Executing (post-create):
+  echo 'Installing dependencies...'
+
+
+🔄 Executing (post-create):
+  echo 'Building project...'
+
+
+🔄 Starting (background):
+  echo 'Starting dev server on port 3000'
+
+🔄 Starting (background):
+  echo 'Watching for file changes'
+
+✅ Created new worktree for feature-hooks at [TMPDIR]/test-repo.feature-hooks