Skip to content

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

refactor(tests): simplify snapshot testing with auto-bound settings (#396)

Maximilian Roos49c15097ff26
diff --git a/docs/content/claude-code.md b/docs/content/claude-code.md
index bd3e458a9..f429dc977 100644
--- a/docs/content/claude-code.md
+++ b/docs/content/claude-code.md
@@ -12,7 +12,7 @@ Worktrunk includes a Claude Code plugin that automatically tracks which worktree
The plugin adds status indicators to `wt list`:
-<!-- ⚠️ AUTO-GENERATED-HTML from tests/snapshots/integration__integration_tests__list__with_user_marker.snap — edit source to update -->
+<!-- ⚠️ AUTO-GENERATED-HTML from tests/snapshots/integration__integration_tests__list__list_with_user_marker.snap — edit source to update -->
{% terminal() %}
<span class="prompt">$</span> <span class="cmd">wt list</span>
diff --git a/tests/common/list_snapshots.rs b/tests/common/list_snapshots.rs
index 7cc9c6d67..b0b82150c 100644
--- a/tests/common/list_snapshots.rs
+++ b/tests/common/list_snapshots.rs
@@ -1,24 +1,11 @@
// Functions here are conditionally used based on platform (#[cfg(not(windows))]).
#![allow(dead_code)]
-use super::{TestRepo, setup_snapshot_settings, wt_command};
-use insta::Settings;
+use super::{TestRepo, wt_command};
use std::path::Path;
use std::process::Command;
use worktrunk::styling::DEFAULT_HELP_WIDTH;
-pub fn json_settings(repo: &TestRepo) -> Settings {
- let mut settings = setup_snapshot_settings(repo);
- // JSON-specific filters for timestamps and escaped ANSI codes
- settings.add_filter(r#""timestamp": \d+"#, r#""timestamp": 0"#);
- settings.add_filter(r"\\u001b\[32m", "[GREEN]");
- settings.add_filter(r"\\u001b\[31m", "[RED]");
- settings.add_filter(r"\\u001b\[2m", "[DIM]");
- settings.add_filter(r"\\u001b\[0m", "[RESET]");
- settings.add_filter(r"\\\\", "/");
- settings
-}
-
pub fn command(repo: &TestRepo, cwd: &Path) -> Command {
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 1a7a35370..4327d462c 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -813,6 +813,8 @@ pub struct TestRepo {
git_config_path: PathBuf,
/// Path to mock bin directory for gh/glab commands
mock_bin_path: Option<PathBuf>,
+ /// Snapshot settings guard - keeps insta filters active for this repo's lifetime
+ _snapshot_guard: insta::internals::SettingsBindDropGuard,
}
impl TestRepo {
@@ -838,14 +840,19 @@ impl TestRepo {
let test_config_path = temp_dir.path().join("test-config.toml");
let git_config_path = temp_dir.path().join("test-gitconfig");
+ // Bind full snapshot settings (including ANSI cleanup) for all tests
+ let worktrees = HashMap::new();
+ let snapshot_guard = setup_snapshot_settings_for_paths(&root, &worktrees).bind_to_scope();
+
let mut repo = Self {
temp_dir,
root,
- worktrees: HashMap::new(),
+ worktrees,
remote: None,
test_config_path,
git_config_path,
mock_bin_path: None,
+ _snapshot_guard: snapshot_guard,
};
// Mock gh/glab as authenticated to prevent CI hints in test output
@@ -876,14 +883,19 @@ impl TestRepo {
)
.unwrap();
+ // Set up snapshot settings before creating the repo (worktrees empty initially)
+ let worktrees = HashMap::new();
+ let snapshot_guard = setup_snapshot_settings_for_paths(&root, &worktrees).bind_to_scope();
+
let repo = Self {
temp_dir,
root,
- worktrees: HashMap::new(),
+ worktrees,
remote: None,
test_config_path,
git_config_path,
mock_bin_path: None,
+ _snapshot_guard: snapshot_guard,
};
// Run git init (can't avoid this for empty repos)
@@ -1932,6 +1944,16 @@ pub fn add_standard_env_redactions(settings: &mut insta::Settings) {
/// This extracts the common settings configuration while allowing the
/// `assert_cmd_snapshot!` macro to remain in test files for correct module path capture.
pub fn setup_snapshot_settings(repo: &TestRepo) -> insta::Settings {
+ setup_snapshot_settings_for_paths(repo.root_path(), &repo.worktrees)
+}
+
+/// Full snapshot settings - path filters AND ANSI cleanup.
+/// Use this with `settings.bind()` for assert_cmd_snapshot! tests.
+/// Clones current settings (which may already have minimal path filters from TestRepo).
+fn setup_snapshot_settings_for_paths(
+ root: &Path,
+ worktrees: &HashMap<String, PathBuf>,
+) -> insta::Settings {
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_path("../snapshots");
@@ -1951,8 +1973,7 @@ pub fn setup_snapshot_settings(repo: &TestRepo) -> insta::Settings {
settings.add_filter(r"\\", "/");
// Normalize paths (canonicalize for macOS /var -> /private/var symlink)
- let root_canonical =
- canonicalize(repo.root_path()).unwrap_or_else(|_| repo.root_path().to_path_buf());
+ let root_canonical = canonicalize(root).unwrap_or_else(|_| root.to_path_buf());
let root_str = root_canonical.to_str().unwrap();
// Convert backslashes to forward slashes before escaping (backslash filter already ran)
let root_str_normalized = root_str.replace('\\', "/");
@@ -1979,7 +2000,7 @@ pub fn setup_snapshot_settings(repo: &TestRepo) -> insta::Settings {
settings.add_filter(&tilde_worktree_pattern, "_REPO_$1");
}
- for (name, path) in &repo.worktrees {
+ for (name, path) in worktrees {
let canonical = canonicalize(path).unwrap_or_else(|_| path.clone());
let path_str = canonical.to_str().unwrap();
let replacement = format!("_WORKTREE_{}_", name.to_uppercase().replace('-', "_"));
diff --git a/tests/integration_tests/approval_ui.rs b/tests/integration_tests/approval_ui.rs
index 1f5e7b29d..c686011ba 100644
--- a/tests/integration_tests/approval_ui.rs
+++ b/tests/integration_tests/approval_ui.rs
@@ -1,6 +1,6 @@
//! Tests for command approval UI
-use crate::common::{TestRepo, make_snapshot_cmd, repo, setup_snapshot_settings};
+use crate::common::{TestRepo, make_snapshot_cmd, repo};
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
use std::fs;
@@ -9,36 +9,33 @@ use std::process::Stdio;
/// Helper to create snapshot with test environment
fn snapshot_approval(test_name: &str, repo: &TestRepo, args: &[&str], approve: bool) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "switch", args, None);
- cmd.stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped());
-
- let mut child = cmd.spawn().unwrap();
-
- // Write approval response
- {
- let stdin = child.stdin.as_mut().unwrap();
- let response = if approve { b"y\n" } else { b"n\n" };
- stdin.write_all(response).unwrap();
- }
-
- let output = child.wait_with_output().unwrap();
-
- // Use insta snapshot for combined output
- let stdout = String::from_utf8_lossy(&output.stdout);
- let stderr = String::from_utf8_lossy(&output.stderr);
- let combined = format!(
- "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
- output.status.code().unwrap_or(-1),
- stdout,
- stderr
- );
-
- insta::assert_snapshot!(test_name, combined);
- });
+ let mut cmd = make_snapshot_cmd(repo, "switch", args, None);
+ cmd.stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped());
+
+ let mut child = cmd.spawn().unwrap();
+
+ // Write approval response
+ {
+ let stdin = child.stdin.as_mut().unwrap();
+ let response = if approve { b"y\n" } else { b"n\n" };
+ stdin.write_all(response).unwrap();
+ }
+
+ let output = child.wait_with_output().unwrap();
+
+ // Use insta snapshot for combined output
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ let combined = format!(
+ "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
+ output.status.code().unwrap_or(-1),
+ stdout,
+ stderr
+ );
+
+ insta::assert_snapshot!(test_name, combined);
}
#[rstest]
@@ -112,11 +109,10 @@ fn test_yes_flag_does_not_save_approvals(repo: TestRepo) {
repo.commit("Add config");
// Run with --yes
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "test-yes", "--yes"], None);
- assert_cmd_snapshot!("yes_does_not_save_approvals_first_run", cmd);
- });
+ assert_cmd_snapshot!(
+ "yes_does_not_save_approvals_first_run",
+ make_snapshot_cmd(&repo, "switch", &["--create", "test-yes", "--yes"], None)
+ );
// Clean up the worktree
repo.wt_command()
@@ -149,11 +145,10 @@ approved-commands = ["echo 'approved' > output.txt"]
));
// Should execute without prompting
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "test-approved"], None);
- assert_cmd_snapshot!("already_approved_skip_prompt", cmd);
- });
+ assert_cmd_snapshot!(
+ "already_approved_skip_prompt",
+ make_snapshot_cmd(&repo, "switch", &["--create", "test-approved"], None)
+ );
}
#[rstest]
@@ -211,36 +206,33 @@ test = "echo 'Running tests...'"
/// Helper for step hook snapshot tests with approval prompt
fn snapshot_run_hook(test_name: &str, repo: &TestRepo, hook_type: &str, approve: bool) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "hook", &[hook_type], None);
- cmd.stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped());
-
- let mut child = cmd.spawn().unwrap();
-
- // Write approval response
- {
- let stdin = child.stdin.as_mut().unwrap();
- let response = if approve { b"y\n" } else { b"n\n" };
- stdin.write_all(response).unwrap();
- }
-
- let output = child.wait_with_output().unwrap();
-
- // Use insta snapshot for combined output
- let stdout = String::from_utf8_lossy(&output.stdout);
- let stderr = String::from_utf8_lossy(&output.stderr);
- let combined = format!(
- "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
- output.status.code().unwrap_or(-1),
- stdout,
- stderr
- );
-
- insta::assert_snapshot!(test_name, combined);
- });
+ let mut cmd = make_snapshot_cmd(repo, "hook", &[hook_type], None);
+ cmd.stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped());
+
+ let mut child = cmd.spawn().unwrap();
+
+ // Write approval response
+ {
+ let stdin = child.stdin.as_mut().unwrap();
+ let response = if approve { b"y\n" } else { b"n\n" };
+ stdin.write_all(response).unwrap();
+ }
+
+ let output = child.wait_with_output().unwrap();
+
+ // Use insta snapshot for combined output
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ let combined = format!(
+ "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
+ output.status.code().unwrap_or(-1),
+ stdout,
+ stderr
+ );
+
+ insta::assert_snapshot!(test_name, combined);
}
/// Test that `wt hook pre-merge` requires approval (security boundary test)
@@ -292,11 +284,10 @@ fn test_approval_fails_in_non_tty(repo: TestRepo) {
// Run WITHOUT piping stdin - this simulates non-TTY environment
// When running under cargo test, stdin is not a TTY
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "test-non-tty"], None);
- assert_cmd_snapshot!("approval_fails_in_non_tty", cmd);
- });
+ assert_cmd_snapshot!(
+ "approval_fails_in_non_tty",
+ make_snapshot_cmd(&repo, "switch", &["--create", "test-non-tty"], None)
+ );
}
/// Test that --yes flag bypasses TTY requirement
@@ -308,16 +299,12 @@ fn test_yes_bypasses_tty_check(repo: TestRepo) {
repo.commit("Add config");
// Run with --yes to bypass approval entirely
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(
- &repo,
- "switch",
- &["--create", "test-yes-tty", "--yes"],
- None,
- );
- assert_cmd_snapshot!("yes_bypasses_tty_check", cmd);
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "switch",
+ &["--create", "test-yes-tty", "--yes"],
+ None
+ ));
}
/// Test that `{{ target }}` is the current branch when running standalone
@@ -449,12 +436,10 @@ lint = "echo 'lint'"
repo.commit("Add pre-merge hooks");
// Run with a name that doesn't exist
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd =
- make_snapshot_cmd(&repo, "hook", &["pre-merge", "nonexistent", "--yes"], None);
- assert_cmd_snapshot!("step_hook_unknown_name_error", cmd);
- });
+ assert_cmd_snapshot!(
+ "step_hook_unknown_name_error",
+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "nonexistent", "--yes"], None)
+ );
}
/// Test error message when hook has no named commands
@@ -465,45 +450,41 @@ fn test_step_hook_name_filter_on_unnamed_command(repo: TestRepo) {
repo.commit("Add pre-merge hook");
// Run with a name filter on a hook that has no named commands
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "hook", &["pre-merge", "test", "--yes"], None);
- assert_cmd_snapshot!("step_hook_name_filter_on_unnamed", cmd);
- });
+ assert_cmd_snapshot!(
+ "step_hook_name_filter_on_unnamed",
+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "test", "--yes"], None)
+ );
}
/// Helper for step hook snapshot tests with extra args and approval prompt
fn snapshot_run_hook_with_args(test_name: &str, repo: &TestRepo, args: &[&str], approve: bool) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "hook", args, None);
- cmd.stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped());
-
- let mut child = cmd.spawn().unwrap();
-
- // Write approval response
- {
- let stdin = child.stdin.as_mut().unwrap();
- let response = if approve { b"y\n" } else { b"n\n" };
- stdin.write_all(response).unwrap();
- }
-
- let output = child.wait_with_output().unwrap();
-
- // Use insta snapshot for combined output
- let stdout = String::from_utf8_lossy(&output.stdout);
- let stderr = String::from_utf8_lossy(&output.stderr);
- let combined = format!(
- "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
- output.status.code().unwrap_or(-1),
- stdout,
- stderr
- );
-
- insta::assert_snapshot!(test_name, combined);
- });
+ let mut cmd = make_snapshot_cmd(repo, "hook", args, None);
+ cmd.stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped());
+
+ let mut child = cmd.spawn().unwrap();
+
+ // Write approval response
+ {
+ let stdin = child.stdin.as_mut().unwrap();
+ let response = if approve { b"y\n" } else { b"n\n" };
+ stdin.write_all(response).unwrap();
+ }
+
+ let output = child.wait_with_output().unwrap();
+
+ // Use insta snapshot for combined output
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ let combined = format!(
+ "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
+ output.status.code().unwrap_or(-1),
+ stdout,
+ stderr
+ );
+
+ insta::assert_snapshot!(test_name, combined);
}
/// Test that `project:` prefix filter still requires approval (security fix test)
@@ -561,11 +542,10 @@ test = "echo 'user test'"
);
// Running with user: prefix should not prompt for approval
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "hook", &["pre-merge", "user:test"], None);
- assert_cmd_snapshot!("user_prefix_skips_approval", cmd);
- });
+ assert_cmd_snapshot!(
+ "user_prefix_skips_approval",
+ make_snapshot_cmd(&repo, "hook", &["pre-merge", "user:test"], None)
+ );
}
/// Test running all hooks (no name filter) still works
@@ -614,9 +594,8 @@ third = "echo 'third' >> output.txt"
#[cfg(unix)] // select command is unix-only
#[rstest]
fn test_select_fails_in_non_tty(repo: TestRepo) {
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "select", &[], None);
- assert_cmd_snapshot!("select_fails_in_non_tty", cmd);
- });
+ assert_cmd_snapshot!(
+ "select_fails_in_non_tty",
+ make_snapshot_cmd(&repo, "select", &[], None)
+ );
}
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index 6286dbd43..c825485a1 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -39,7 +39,7 @@ fn test_configure_shell_with_yes(repo: TestRepo, temp_home: TempDir) {
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
-   autoload -Uz compinit && compinit
+   autoload -Uz compinit && compinit
↳ Restart shell to activate shell integration
");
});
@@ -81,7 +81,7 @@ fn test_configure_shell_specific_shell(repo: TestRepo, temp_home: TempDir) {
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
-   autoload -Uz compinit && compinit
+   autoload -Uz compinit && compinit
↳ Restart shell to activate shell integration
");
});
@@ -330,7 +330,7 @@ fn test_configure_shell_multiple_configs(repo: TestRepo, temp_home: TempDir) {
✓ Configured 2 shells
▲ Completions require compinit; add to ~/.zshrc before the wt line:
-   autoload -Uz compinit && compinit
+   autoload -Uz compinit && compinit
↳ Restart shell to activate shell integration
");
});
@@ -390,7 +390,7 @@ fn test_configure_shell_mixed_states(repo: TestRepo, temp_home: TempDir) {
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
-   autoload -Uz compinit && compinit
+   autoload -Uz compinit && compinit
↳ Restart shell to activate shell integration
");
});
diff --git a/tests/integration_tests/for_each.rs b/tests/integration_tests/for_each.rs
index 182749e88..4570089af 100644
--- a/tests/integration_tests/for_each.rs
+++ b/tests/integration_tests/for_each.rs
@@ -1,105 +1,93 @@
//! Integration tests for `wt step for-each`
-use crate::common::{TestRepo, make_snapshot_cmd, repo, setup_snapshot_settings};
+use crate::common::{TestRepo, make_snapshot_cmd, repo};
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
-/// Helper to create snapshot for for-each command
-fn snapshot_for_each(test_name: &str, repo: &TestRepo, args: &[&str]) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "step", args, None);
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
#[rstest]
fn test_for_each_single_worktree(repo: TestRepo) {
- // Only main worktree exists
- snapshot_for_each(
- "for_each_single_worktree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "git", "status", "--short"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_multiple_worktrees(mut repo: TestRepo) {
- // Create additional worktrees
repo.add_worktree("feature-a");
repo.add_worktree("feature-b");
- snapshot_for_each(
- "for_each_multiple_worktrees",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "git", "branch", "--show-current"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_command_fails_in_one(mut repo: TestRepo) {
repo.add_worktree("feature");
- // Use a command that will fail: try to show a non-existent ref
- snapshot_for_each(
- "for_each_command_fails",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "git", "show", "nonexistent-ref"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_no_args_error(repo: TestRepo) {
- // Missing arguments should show error
- snapshot_for_each("for_each_no_args", &repo, &["for-each"]);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "step", &["for-each"], None));
}
#[rstest]
fn test_for_each_with_detached_head(mut repo: TestRepo) {
- // Create a worktree and detach its HEAD
repo.add_worktree("detached-test");
repo.detach_head_in_worktree("detached-test");
- snapshot_for_each(
- "for_each_with_detached",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "git", "status", "--short"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_with_template(repo: TestRepo) {
- // Test template expansion with {{ branch }}
- snapshot_for_each(
- "for_each_with_template",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "echo", "Branch: {{ branch }}"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_detached_branch_variable(mut repo: TestRepo) {
- // Regression test: {{ branch }} should expand to "HEAD" in detached worktrees
- // Previously, it incorrectly expanded to "(detached)" because the display
- // string was passed to CommandContext instead of None
repo.add_worktree("detached-test");
repo.detach_head_in_worktree("detached-test");
- snapshot_for_each(
- "for_each_detached_branch_variable",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "echo", "Branch: {{ branch }}"],
- );
+ None,
+ ));
}
#[rstest]
fn test_for_each_spawn_fails(mut repo: TestRepo) {
- // Test when command cannot be spawned (binary doesn't exist)
repo.add_worktree("feature");
- snapshot_for_each(
- "for_each_spawn_fails",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "step",
&["for-each", "--", "nonexistent-command-12345", "--some-arg"],
- );
+ None,
+ ));
}
diff --git a/tests/integration_tests/init.rs b/tests/integration_tests/init.rs
index 7b1395f4f..10d092347 100644
--- a/tests/integration_tests/init.rs
+++ b/tests/integration_tests/init.rs
@@ -59,14 +59,12 @@ fn test_init_invalid_shell(repo: TestRepo) {
.arg("invalid-shell")
.current_dir(repo.root_path());
- assert_cmd_snapshot!(cmd, @r"
+ assert_cmd_snapshot!(cmd, @"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
- error: invalid value 'invalid-shell' for '<bash|fish|zsh|powershell>'
- [possible values: bash, fish, zsh, powershell]
For more information, try '--help'.
");
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 36d07bb83..f1dcfc058 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -1,109 +1,8 @@
use crate::common::{
- DAY, HOUR, MINUTE, TestRepo, list_snapshots, repo, repo_with_remote, setup_snapshot_settings,
- wt_command,
+ DAY, HOUR, MINUTE, TestRepo, list_snapshots, repo, repo_with_remote, wt_command,
};
-use insta::Settings;
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
-use std::path::Path;
-use std::process::Command;
-
-fn snapshot_list(test_name: &str, repo: &TestRepo) {
- run_snapshot(
- setup_snapshot_settings(repo),
- test_name,
- list_snapshots::command(repo, repo.root_path()),
- );
-}
-
-fn snapshot_list_from_dir(test_name: &str, repo: &TestRepo, cwd: &Path) {
- run_snapshot(
- setup_snapshot_settings(repo),
- test_name,
- list_snapshots::command(repo, cwd),
- );
-}
-
-fn snapshot_list_json(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--format=json");
- run_snapshot(list_snapshots::json_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_with_branches(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--branches");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_with_remotes(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--remotes");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_with_branches_and_remotes(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.args(["--branches", "--remotes"]);
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_full(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--full");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_progressive(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--progressive");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_no_progressive(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.arg("--no-progressive");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_progressive_branches(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.args(["--progressive", "--branches"]);
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_list_progressive_full(test_name: &str, repo: &TestRepo) {
- let mut cmd = list_snapshots::command(repo, repo.root_path());
- cmd.args(["--progressive", "--full"]);
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-// README example snapshots - use narrower width for doc site code blocks
-fn snapshot_readme_list_from_dir(test_name: &str, repo: &TestRepo, cwd: &Path) {
- run_snapshot(
- setup_snapshot_settings(repo),
- test_name,
- list_snapshots::command_readme(repo, cwd),
- );
-}
-
-fn snapshot_readme_list_full_from_dir(test_name: &str, repo: &TestRepo, cwd: &Path) {
- let mut cmd = list_snapshots::command_readme(repo, cwd);
- cmd.arg("--full");
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn snapshot_readme_list_branches_full_from_dir(test_name: &str, repo: &TestRepo, cwd: &Path) {
- let mut cmd = list_snapshots::command_readme(repo, cwd);
- cmd.args(["--branches", "--full"]);
- run_snapshot(setup_snapshot_settings(repo), test_name, cmd);
-}
-
-fn run_snapshot(settings: Settings, test_name: &str, mut cmd: Command) {
- settings.bind(|| {
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
/// Creates worktrees with specific timestamps for ordering tests.
/// Returns the path to feature-current (the worktree to run tests from).
@@ -191,7 +90,7 @@ fn setup_timestamped_worktrees(repo: &mut TestRepo) -> std::path::PathBuf {
#[rstest]
fn test_list_single_worktree(repo: TestRepo) {
- snapshot_list("single_worktree", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -199,7 +98,7 @@ fn test_list_multiple_worktrees(mut repo: TestRepo) {
repo.add_worktree("feature-a");
repo.add_worktree("feature-b");
- snapshot_list("multiple_worktrees", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
/// Test that the `-` gutter symbol appears for the previous worktree (target of `wt switch -`).
@@ -228,14 +127,14 @@ fn test_list_previous_worktree_gutter(mut repo: TestRepo) {
cmd.output().unwrap();
// Now list should show `-` for feature (the previous worktree, target of `wt switch -`)
- snapshot_list("previous_worktree_gutter", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
fn test_list_detached_head(repo: TestRepo) {
repo.detach_head();
- snapshot_list("detached_head", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -246,7 +145,7 @@ fn test_list_detached_head_in_worktree(mut repo: TestRepo) {
repo.add_worktree("feature");
repo.detach_head_in_worktree("feature");
- snapshot_list("detached_head_in_worktree", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -254,7 +153,7 @@ fn test_list_locked_worktree(mut repo: TestRepo) {
repo.add_worktree("locked-feature");
repo.lock_worktree("locked-feature", Some("Testing lock functionality"));
- snapshot_list("locked_worktree", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -262,7 +161,7 @@ fn test_list_locked_no_reason(mut repo: TestRepo) {
repo.add_worktree("locked-no-reason");
repo.lock_worktree("locked-no-reason", None);
- snapshot_list("locked_no_reason", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
// Removed: test_list_long_branch_name - covered by spacing_edge_cases.rs
@@ -275,7 +174,7 @@ fn test_list_long_commit_message(mut repo: TestRepo) {
repo.add_worktree("feature-a");
repo.commit("Short message");
- snapshot_list("long_commit_message", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
// Removed: test_list_unicode_branch_name - covered by spacing_edge_cases.rs
@@ -288,7 +187,7 @@ fn test_list_unicode_commit_message(mut repo: TestRepo) {
repo.add_worktree("feature-test");
repo.commit("Fix bug with café ☕ handling");
- snapshot_list("unicode_commit_message", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -303,7 +202,7 @@ fn test_list_many_worktrees_with_varied_stats(mut repo: TestRepo) {
// Add some with files to create diff stats
repo.add_worktree("with-changes");
- snapshot_list("many_worktrees_varied", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
// Removed: test_list_json_single_worktree and test_list_json_multiple_worktrees
@@ -318,7 +217,11 @@ fn test_list_json_with_metadata(mut repo: TestRepo) {
repo.add_worktree("locked-feature");
repo.lock_worktree("locked-feature", Some("Testing"));
- snapshot_list_json("json_with_metadata", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
}
/// Test that committed_trees_match is true when a branch has commits ahead but identical tree content.
@@ -346,7 +249,11 @@ fn test_list_json_tree_matches_main_after_merge(mut repo: TestRepo) {
// Now feature-merged is ahead of main (has merge commit) but tree content matches main
// JSON output should show branch_op_state: "TreesMatch" with ahead > 0
- snapshot_list_json("json_tree_matches_main_after_merge", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
}
#[rstest]
@@ -359,7 +266,11 @@ fn test_list_with_branches_flag(mut repo: TestRepo) {
// Create one branch with a worktree
repo.add_worktree("feature-with-worktree");
- snapshot_list_with_branches("with_branches_flag", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--branches");
+ cmd
+ });
}
#[rstest]
@@ -368,7 +279,11 @@ fn test_list_with_branches_flag_no_available(mut repo: TestRepo) {
repo.add_worktree("feature-a");
repo.add_worktree("feature-b");
- snapshot_list_with_branches("with_branches_flag_none_available", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--branches");
+ cmd
+ });
}
#[rstest]
@@ -378,7 +293,11 @@ fn test_list_with_branches_flag_only_branches(repo: TestRepo) {
repo.create_branch("branch-beta");
repo.create_branch("branch-gamma");
- snapshot_list_with_branches("with_branches_flag_only_branches", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--branches");
+ cmd
+ });
}
#[rstest]
@@ -397,7 +316,11 @@ fn test_list_with_remotes_flag(#[from(repo_with_remote)] repo: TestRepo) {
// - origin/remote-feature-1 (remote branch without local worktree)
// - origin/remote-feature-2 (remote branch without local worktree)
// Should NOT show origin/main (main has a worktree)
- snapshot_list_with_remotes("with_remotes_flag", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--remotes");
+ cmd
+ });
}
#[rstest]
@@ -419,7 +342,11 @@ fn test_list_with_remotes_and_branches(#[from(repo_with_remote)] repo: TestRepo)
// - local-only-2 branch (local, no worktree)
// - origin/remote-only-1 (remote, no local)
// - origin/remote-only-2 (remote, no local)
- snapshot_list_with_branches_and_remotes("with_remotes_and_branches", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.args(["--branches", "--remotes"]);
+ cmd
+ });
}
#[rstest]
@@ -442,7 +369,11 @@ fn test_list_with_remotes_filters_tracked_worktrees(#[from(repo_with_remote)] mu
// - feature-with-worktree worktree
// - origin/remote-only (remote branch not tracked by any local branch)
// Should NOT show origin/main or origin/feature-with-worktree (both tracked)
- snapshot_list_with_remotes("with_remotes_filters_tracked_worktrees", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--remotes");
+ cmd
+ });
}
#[rstest]
@@ -461,7 +392,11 @@ fn test_list_with_remotes_filters_tracked_branches(#[from(repo_with_remote)] rep
// - origin/remote-only (remote branch not tracked by any local branch)
// Should NOT show origin/main (tracked by main + has worktree)
// Should NOT show origin/tracked-branch (tracked by local tracked-branch)
- snapshot_list_with_remotes("with_remotes_filters_tracked_branches", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--remotes");
+ cmd
+ });
}
#[rstest]
@@ -492,7 +427,11 @@ fn test_list_json_with_display_fields(mut repo: TestRepo) {
repo.commit("Main commit 1");
repo.commit("Main commit 2");
- snapshot_list_json("json_with_display_fields", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
}
#[rstest]
@@ -500,7 +439,7 @@ fn test_list_ordering_rules(mut repo: TestRepo) {
let current_path = setup_timestamped_worktrees(&mut repo);
// Run from feature-current worktree to test "current worktree" logic
- snapshot_list_from_dir("list_ordering_rules", &repo, &current_path);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, &current_path));
}
#[rstest]
@@ -557,9 +496,7 @@ fn test_list_with_upstream_tracking(mut repo: TestRepo) {
repo.run_git_in(&no_upstream_wt, &["status", "--porcelain"]);
// Run list --branches --full to show all columns including Remote
- let settings = setup_snapshot_settings(&repo);
-
- settings.bind(|| {
+ assert_cmd_snapshot!("with_upstream_tracking", {
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
repo.configure_mock_commands(&mut cmd);
@@ -567,7 +504,7 @@ fn test_list_with_upstream_tracking(mut repo: TestRepo) {
.arg("--branches")
.arg("--full")
.current_dir(repo.root_path());
- assert_cmd_snapshot!("with_upstream_tracking", cmd);
+ cmd
});
}
@@ -579,7 +516,7 @@ fn test_list_primary_on_different_branch(mut repo: TestRepo) {
repo.add_worktree("feature-a");
repo.add_worktree("feature-b");
- snapshot_list("list_primary_on_different_branch", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -612,7 +549,7 @@ fn test_list_with_user_marker(mut repo: TestRepo) {
let wip_wt = repo.add_worktree("wip-docs");
std::fs::write(wip_wt.join("README.md"), "# Documentation").unwrap();
- snapshot_list("with_user_marker", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -628,7 +565,11 @@ fn test_list_json_with_user_marker(mut repo: TestRepo) {
// Worktree without user marker
repo.add_worktree("without-status");
- snapshot_list_json("json_with_user_marker", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
}
#[rstest]
@@ -675,7 +616,11 @@ fn test_list_json_with_git_operation(mut repo: TestRepo) {
);
// JSON output should show git_operation: "rebase" for the feature worktree
- snapshot_list_json("json_with_git_operation", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--format=json");
+ cmd
+ });
}
#[rstest]
@@ -689,7 +634,11 @@ fn test_list_branch_only_with_status(repo: TestRepo) {
repo.set_marker("branch-only", "🌿");
// Use --branches flag to show branch-only entries
- snapshot_list_with_branches("branch_only_with_status", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--branches");
+ cmd
+ });
}
#[rstest]
@@ -702,7 +651,7 @@ fn test_list_user_marker_with_special_characters(mut repo: TestRepo) {
repo.add_worktree("multi");
repo.set_marker("multi", "👨‍💻");
- snapshot_list("user_marker_special_chars", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
/// Set up a repo for README examples showing realistic worktree states.
@@ -1555,7 +1504,10 @@ fn mock_ci_status(repo: &TestRepo, branch: &str, status: &str, source: &str, is_
#[rstest]
fn test_readme_example_list(mut repo: TestRepo) {
let feature_api = setup_readme_example_repo(&mut repo);
- snapshot_readme_list_from_dir("readme_example_list", &repo, &feature_api);
+ assert_cmd_snapshot!(
+ "readme_example_list",
+ list_snapshots::command_readme(&repo, &feature_api)
+ );
}
/// Generate README example: `wt list --full` output
@@ -1566,7 +1518,11 @@ fn test_readme_example_list(mut repo: TestRepo) {
#[rstest]
fn test_readme_example_list_full(mut repo: TestRepo) {
let feature_api = setup_readme_example_repo(&mut repo);
- snapshot_readme_list_full_from_dir("readme_example_list_full", &repo, &feature_api);
+ assert_cmd_snapshot!("readme_example_list_full", {
+ let mut cmd = list_snapshots::command_readme(&repo, &feature_api);
+ cmd.arg("--full");
+ cmd
+ });
}
/// Generate README example: `wt list --branches --full` output
@@ -1577,11 +1533,11 @@ fn test_readme_example_list_full(mut repo: TestRepo) {
#[rstest]
fn test_readme_example_list_branches(mut repo: TestRepo) {
let feature_api = setup_readme_example_repo(&mut repo);
- snapshot_readme_list_branches_full_from_dir(
- "readme_example_list_branches",
- &repo,
- &feature_api,
- );
+ assert_cmd_snapshot!("readme_example_list_branches", {
+ let mut cmd = list_snapshots::command_readme(&repo, &feature_api);
+ cmd.args(["--branches", "--full"]);
+ cmd
+ });
}
/// Generate tips-patterns.md example: dev server per worktree workflow
@@ -1604,10 +1560,9 @@ url = "http://localhost:{{ branch | hash_port }}"
);
// Run from main worktree (URLs dim since no servers running)
- run_snapshot(
- setup_snapshot_settings(&repo),
+ assert_cmd_snapshot!(
"tips_dev_server_workflow",
- list_snapshots::command_readme(&repo, repo.root_path()),
+ list_snapshots::command_readme(&repo, repo.root_path())
);
}
@@ -1618,7 +1573,11 @@ fn test_list_progressive_flag(mut repo: TestRepo) {
// Force progressive mode even in non-TTY test environment
// Output should be identical to buffered mode (only process differs)
- snapshot_list_progressive("progressive_flag", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1626,7 +1585,11 @@ fn test_list_no_progressive_flag(mut repo: TestRepo) {
repo.add_worktree("feature");
// Explicitly force buffered mode
- snapshot_list_no_progressive("no_progressive_flag", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--no-progressive");
+ cmd
+ });
}
#[rstest]
@@ -1640,7 +1603,11 @@ fn test_list_progressive_with_branches(mut repo: TestRepo) {
// Critical: test that --branches works with --progressive
// This ensures progressive mode supports the --branches flag
- snapshot_list_progressive_branches("progressive_with_branches", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.args(["--progressive", "--branches"]);
+ cmd
+ });
}
// ============================================================================
@@ -1649,7 +1616,11 @@ fn test_list_progressive_with_branches(mut repo: TestRepo) {
#[rstest]
fn test_list_task_dag_single_worktree(repo: TestRepo) {
- snapshot_list_progressive("task_dag_single_worktree", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1658,7 +1629,11 @@ fn test_list_task_dag_multiple_worktrees(mut repo: TestRepo) {
repo.add_worktree("feature-b");
repo.add_worktree("feature-c");
- snapshot_list_progressive("task_dag_multiple_worktrees", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1670,7 +1645,11 @@ fn test_list_task_dag_full_with_diffs(mut repo: TestRepo) {
// Create another worktree with commits
let _feature_b = repo.add_worktree_with_commit("feature-b", "file.txt", "test", "Test commit");
- snapshot_list_progressive_full("task_dag_full_with_diffs", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.args(["--progressive", "--full"]);
+ cmd
+ });
}
#[rstest]
@@ -1689,7 +1668,11 @@ fn test_list_task_dag_with_upstream(mut repo: TestRepo) {
repo.run_git_in(&ahead, &["add", "."]);
repo.run_git_in(&ahead, &["commit", "-m", "Ahead commit"]);
- snapshot_list_progressive_full("task_dag_with_upstream", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.args(["--progressive", "--full"]);
+ cmd
+ });
}
#[rstest]
@@ -1699,7 +1682,11 @@ fn test_list_task_dag_many_worktrees(mut repo: TestRepo) {
repo.add_worktree(&format!("feature-{}", i));
}
- snapshot_list_progressive("task_dag_many_worktrees", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1708,14 +1695,22 @@ fn test_list_task_dag_with_locked_worktree(mut repo: TestRepo) {
repo.add_worktree("locked");
repo.lock_worktree("locked", Some("Testing task DAG with locked worktree"));
- snapshot_list_progressive("task_dag_with_locked", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
fn test_list_task_dag_detached_head(repo: TestRepo) {
repo.detach_head();
- snapshot_list_progressive("task_dag_detached_head", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1726,13 +1721,11 @@ fn test_list_task_dag_ordering_stability(mut repo: TestRepo) {
// Run from feature-current worktree
// Expected order: main, feature-current, then by timestamp: feature-newest, feature-middle, feature-oldest
- let mut cmd = list_snapshots::command(&repo, &current_path);
- cmd.arg("--progressive");
- run_snapshot(
- setup_snapshot_settings(&repo),
- "task_dag_ordering_stability",
- cmd,
- );
+ assert_cmd_snapshot!("task_dag_ordering_stability", {
+ let mut cmd = list_snapshots::command(&repo, &current_path);
+ cmd.arg("--progressive");
+ cmd
+ });
}
#[rstest]
@@ -1802,15 +1795,12 @@ fn test_list_with_c_flag(mut repo: TestRepo) {
repo.add_worktree("feature-b");
// Run wt -C <repo_path> list from a completely different directory
- let mut settings = setup_snapshot_settings(&repo);
- // Redact the -C path argument in metadata (try different selector formats)
- settings.add_redaction(".args[1]", "[REPO_PATH]");
- settings.bind(|| {
+ assert_cmd_snapshot!("list_with_c_flag", {
let mut cmd = wt_command();
cmd.args(["-C", repo.root_path().to_str().unwrap(), "list"]);
// Run from system temp dir to ensure -C is actually being used
cmd.current_dir(std::env::temp_dir());
- assert_cmd_snapshot!("list_with_c_flag", cmd);
+ cmd
});
}
@@ -1881,7 +1871,7 @@ fn test_list_large_diffs_alignment(mut repo: TestRepo) {
// Set user marker
repo.set_marker("diverged", "💬");
- snapshot_list("large_diffs_alignment", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -1936,7 +1926,7 @@ fn test_list_status_column_padding_with_emoji(mut repo: TestRepo) {
repo.set_marker("main-symbol", "💬");
- snapshot_list("status_column_padding_emoji", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -1973,7 +1963,7 @@ fn test_list_maximum_working_tree_symbols(mut repo: TestRepo) {
repo.run_git_in(&feature, &["rm", "file-d.txt"]);
// Result should show: ?!+»✘
- snapshot_list("maximum_working_tree_symbols", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
#[rstest]
@@ -2047,11 +2037,10 @@ fn test_list_maximum_status_with_git_operation(mut repo: TestRepo) {
// Result should show: ?!+ (working_tree) + = (conflicts) + ↻ (rebase) + ↕ (diverged) + ⊠ (locked) + 🤖 (user marker)
// Use --full to enable conflict detection
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
+ assert_cmd_snapshot!("maximum_status_with_git_operation", {
let mut cmd = list_snapshots::command(&repo, repo.root_path());
cmd.arg("--full");
- assert_cmd_snapshot!("maximum_status_with_git_operation", cmd);
+ cmd
});
}
@@ -2176,11 +2165,10 @@ fn test_list_maximum_status_symbols(mut repo: TestRepo) {
repo.set_marker("feature", "🤖");
// Result should show 11 chars: ?!+»✘=⊠↕⇅🤖
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
+ assert_cmd_snapshot!("maximum_status_symbols", {
let mut cmd = list_snapshots::command(&repo, repo.root_path());
cmd.arg("--full");
- assert_cmd_snapshot!("maximum_status_symbols", cmd);
+ cmd
});
}
@@ -2213,10 +2201,17 @@ fn test_list_full_working_tree_conflicts(mut repo: TestRepo) {
std::fs::write(feature.join("shared.txt"), "feature's uncommitted version").unwrap();
// Without --full: no conflict symbol (only checks commit-level)
- snapshot_list("working_tree_conflicts_without_full", &repo);
+ assert_cmd_snapshot!(
+ "working_tree_conflicts_without_full",
+ list_snapshots::command(&repo, repo.root_path())
+ );
// With --full: should show conflict symbol because uncommitted changes conflict
- snapshot_list_full("working_tree_conflicts_with_full", &repo);
+ assert_cmd_snapshot!("working_tree_conflicts_with_full", {
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--full");
+ cmd
+ });
}
/// Test that clean working trees don't affect conflict detection with --full.
@@ -2243,8 +2238,15 @@ fn test_list_full_clean_working_tree_uses_commit_conflicts(mut repo: TestRepo) {
// Feature has a committed conflict, working tree is clean
// Both with and without --full should show the conflict symbol
- snapshot_list("commit_conflicts_without_full", &repo);
- snapshot_list_full("commit_conflicts_with_full", &repo);
+ assert_cmd_snapshot!(
+ "commit_conflicts_without_full",
+ list_snapshots::command(&repo, repo.root_path())
+ );
+ assert_cmd_snapshot!("commit_conflicts_with_full", {
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--full");
+ cmd
+ });
}
#[rstest]
@@ -2252,7 +2254,7 @@ fn test_list_warns_when_default_branch_missing_worktree(repo: TestRepo) {
// Move primary worktree off the default branch so no worktree holds it
repo.switch_primary_to("develop");
- snapshot_list("default_branch_missing_worktree", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
/// Test that git errors during task execution are collected and displayed as warnings.
@@ -2272,7 +2274,7 @@ fn test_list_shows_warning_on_git_error(mut repo: TestRepo) {
// Write an invalid SHA that doesn't exist in the repo
std::fs::write(&ref_path, "0000000000000000000000000000000000000000\n").unwrap();
- snapshot_list("git_error_warning", &repo);
+ assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
/// Test that orphan branches (no common ancestor with main) are handled gracefully.
@@ -2316,5 +2318,9 @@ fn test_list_handles_orphan_branch(repo: TestRepo) {
"Expected no merge base for orphan branch"
);
- snapshot_list_with_branches("orphan_branch_no_error", &repo);
+ assert_cmd_snapshot!({
+ let mut cmd = list_snapshots::command(&repo, repo.root_path());
+ cmd.arg("--branches");
+ cmd
+ });
}
diff --git a/tests/integration_tests/list_column_alignment.rs b/tests/integration_tests/list_column_alignment.rs
index 459e108f4..cf59eca4c 100644
--- a/tests/integration_tests/list_column_alignment.rs
+++ b/tests/integration_tests/list_column_alignment.rs
@@ -3,7 +3,7 @@
//! These tests ensure that column headers align with their data,
//! and that progressive rendering maintains consistent alignment.
-use crate::common::{TestRepo, make_snapshot_cmd, repo, setup_snapshot_settings};
+use crate::common::{TestRepo, make_snapshot_cmd, repo};
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
@@ -17,11 +17,7 @@ fn test_status_column_alignment_with_header(mut repo: TestRepo) {
std::fs::write(wt.join("untracked.txt"), "new").unwrap();
std::fs::write(wt.join("file.txt"), "modified").unwrap();
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "list", &[], None);
- assert_cmd_snapshot!("status_column_alignment_check", cmd);
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "list", &[], None));
}
/// Test that Status column width is consistent across all rows
@@ -37,9 +33,5 @@ fn test_status_column_width_consistency(mut repo: TestRepo) {
std::fs::write(wt2.join("file.txt"), "modified").unwrap();
repo.run_git_in(&wt2, &["add", "file.txt"]);
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(&repo, "list", &[], None);
- assert_cmd_snapshot!("status_column_width_consistency", cmd);
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "list", &[], None));
}
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index d065a6918..e3490a6f1 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -1,55 +1,23 @@
use crate::common::{
TestRepo, make_snapshot_cmd, merge_scenario, repo, repo_with_alternate_primary,
repo_with_feature_worktree, repo_with_main_worktree, repo_with_multi_commit_feature,
- setup_snapshot_settings,
};
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
use std::fs;
-use std::path::{Path, PathBuf};
-
-/// Helper to create snapshot with normalized paths
-fn snapshot_merge(test_name: &str, repo: &TestRepo, args: &[&str], cwd: Option<&Path>) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "merge", args, cwd);
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
-/// Helper to snapshot switch command
-fn snapshot_switch(test_name: &str, repo: &TestRepo, args: &[&str], cwd: Option<&Path>) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "switch", args, cwd);
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
-/// Helper to create snapshot with custom environment (for LLM testing)
-fn snapshot_merge_with_env(
- test_name: &str,
- repo: &TestRepo,
- args: &[&str],
- cwd: Option<&std::path::Path>,
- env_vars: &[(&str, &str)],
-) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "merge", args, cwd);
- for (key, value) in env_vars {
- cmd.env(key, value);
- }
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
+use std::path::PathBuf;
#[rstest]
fn test_merge_fast_forward(merge_scenario: (TestRepo, PathBuf)) {
let (repo, feature_wt) = merge_scenario;
// Merge feature into main
- snapshot_merge("merge_fast_forward", &repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "merge",
+ &["main"],
+ Some(&feature_wt)
+ ));
}
/// Test merge when running as a git subcommand (`git wt merge` instead of `wt merge`).
@@ -62,13 +30,11 @@ fn test_merge_as_git_subcommand(merge_scenario: (TestRepo, PathBuf)) {
let (repo, feature_wt) = merge_scenario;
// Merge with GIT_EXEC_PATH set (simulating `git wt merge ...`)
- snapshot_merge_with_env(
- "merge_as_git_subcommand",
- &repo,
- &["main"],
- Some(&feature_wt),
- &[("GIT_EXEC_PATH", "/usr/lib/git-core")],
- );
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "merge", &["main"], Some(&feature_wt));
+ cmd.env("GIT_EXEC_PATH", "/usr/lib/git-core");
+ cmd
+ });
}
#[rstest]
@@ -78,12 +44,12 @@ fn test_merge_when_primary_not_on_default_but_default_has_worktree(
let repo = &mut repo_with_alternate_primary;
let feature_wt = repo.add_feature();
- snapshot_merge(
- "merge_when_primary_not_on_default_but_default_has_worktree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -91,18 +57,18 @@ fn test_merge_with_no_remove_flag(merge_scenario: (TestRepo, PathBuf)) {
let (repo, feature_wt) = merge_scenario;
// Merge with --no-remove flag (should not finish worktree)
- snapshot_merge(
- "merge_with_no_remove",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--no-remove"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
fn test_merge_already_on_target(repo: TestRepo) {
// Already on main branch (repo root)
- snapshot_merge("merge_already_on_target", &repo, &[], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &[], None));
}
#[rstest]
@@ -112,12 +78,12 @@ fn test_merge_dirty_working_tree(mut repo: TestRepo) {
std::fs::write(feature_wt.join("dirty.txt"), "uncommitted content").unwrap();
// Try to merge (should fail due to dirty working tree)
- snapshot_merge(
- "merge_dirty_working_tree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -133,12 +99,12 @@ fn test_merge_not_fast_forward(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Try to merge (should fail or require actual merge)
- snapshot_merge(
- "merge_not_fast_forward",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
/// Test that `wt merge --no-commit` shows merge-context hint when main has newer commits.
@@ -181,12 +147,12 @@ fn test_merge_no_commit_not_fast_forward(repo: TestRepo) {
// Try to merge with --no-commit --no-remove (skips rebase, so push fails with not-fast-forward)
// Main has "Add main file" commit that feature doesn't have as ancestor
- snapshot_merge(
- "merge_no_commit_not_fast_forward",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--no-commit", "--no-remove"],
- Some(&feature_path),
- );
+ Some(&feature_path)
+ ));
}
#[rstest]
@@ -233,7 +199,12 @@ fn test_merge_rebase_conflict(repo: TestRepo) {
);
// Try to merge - should fail with rebase conflict
- snapshot_merge("merge_rebase_conflict", &repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "merge",
+ &["main"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -241,7 +212,7 @@ fn test_merge_to_default_branch(merge_scenario: (TestRepo, PathBuf)) {
let (repo, feature_wt) = merge_scenario;
// Merge without specifying target (should use default branch)
- snapshot_merge("merge_to_default", &repo, &[], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &[], Some(&feature_wt)));
}
#[rstest]
@@ -249,7 +220,7 @@ fn test_merge_with_caret_symbol(merge_scenario: (TestRepo, PathBuf)) {
let (repo, feature_wt) = merge_scenario;
// Merge using ^ symbol (should resolve to default branch)
- snapshot_merge("merge_with_caret", &repo, &["^"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &["^"], Some(&feature_wt)));
}
#[rstest]
@@ -258,12 +229,12 @@ fn test_merge_error_detached_head(repo: TestRepo) {
repo.detach_head();
// Try to merge (should fail - detached HEAD)
- snapshot_merge(
- "merge_error_detached_head",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(repo.root_path()),
- );
+ Some(repo.root_path())
+ ));
}
#[rstest]
@@ -276,12 +247,12 @@ fn test_merge_squash_deterministic(mut repo_with_main_worktree: TestRepo) {
repo.commit_in_worktree(&feature_wt, "file3.txt", "content 3", "docs: update readme");
// Merge (squashing is now the default - no LLM configured, should use deterministic message)
- snapshot_merge(
- "merge_squash_deterministic",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -312,7 +283,12 @@ args = ["-c", "cat >/dev/null && echo 'feat: implement user authentication syste
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
// (squashing is now the default, no need for --squash flag)
- snapshot_merge("merge_squash_with_llm", repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ repo,
+ "merge",
+ &["main"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -324,16 +300,14 @@ fn test_merge_squash_llm_command_not_found(mut repo_with_main_worktree: TestRepo
repo.commit_in_worktree(&feature_wt, "file2.txt", "content 2", "fix: bug fix");
// Configure LLM command that doesn't exist - should error
- snapshot_merge_with_env(
- "merge_squash_llm_command_not_found",
- repo,
- &["main"],
- Some(&feature_wt),
- &[(
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(repo, "merge", &["main"], Some(&feature_wt));
+ cmd.env(
"WORKTRUNK_COMMIT_GENERATION__COMMAND",
"nonexistent-llm-command",
- )],
- );
+ );
+ cmd
+ });
}
#[rstest]
@@ -359,7 +333,12 @@ args = ["-c", "cat > /dev/null; echo 'Error: connection refused' >&2 && exit 1"]
"#;
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
- snapshot_merge("merge_squash_llm_error", repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ repo,
+ "merge",
+ &["main"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -370,12 +349,12 @@ fn test_merge_squash_single_commit(mut repo_with_main_worktree: TestRepo) {
repo.add_worktree_with_commit("feature", "file1.txt", "content", "feat: single commit");
// Merge (squashing is default) - should skip squashing since there's only one commit
- snapshot_merge(
- "merge_squash_single_commit",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -384,12 +363,12 @@ fn test_merge_no_squash(repo_with_multi_commit_feature: TestRepo) {
let feature_wt = &repo.worktrees["feature"];
// Merge with --no-squash - should NOT squash the commits
- snapshot_merge(
- "merge_no_squash",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main", "--no-squash"],
- Some(feature_wt),
- );
+ Some(feature_wt)
+ ));
}
#[rstest]
@@ -417,12 +396,12 @@ fn test_merge_squash_empty_changes(mut repo_with_main_worktree: TestRepo) {
);
// Merge (squashing is default) - should succeed even when commits result in no net changes
- snapshot_merge(
- "merge_squash_empty_changes",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -440,12 +419,12 @@ fn test_merge_auto_commit_deterministic(mut repo_with_main_worktree: TestRepo) {
std::fs::write(feature_wt.join("feature.txt"), "modified content").unwrap();
// Merge - should auto-commit with deterministic message (no LLM configured)
- snapshot_merge(
- "merge_auto_commit_deterministic",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -472,12 +451,12 @@ args = ["-c", "cat >/dev/null && echo 'fix: improve auth validation logic'"]
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
// Merge with LLM configured - should auto-commit with LLM commit message
- snapshot_merge(
- "merge_auto_commit_with_llm",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -498,12 +477,12 @@ args = ["-c", "cat >/dev/null && echo 'fix: update file 1 content'"]
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
// Merge (squashing is default) - should stage uncommitted changes, then squash all commits including the staged changes
- snapshot_merge(
- "merge_auto_commit_and_squash",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(feature_wt),
- );
+ Some(feature_wt)
+ ));
}
#[rstest]
@@ -518,16 +497,16 @@ fn test_merge_with_untracked_files(mut repo_with_main_worktree: TestRepo) {
std::fs::write(feature_wt.join("untracked2.txt"), "untracked content 2").unwrap();
// Merge - should show warning about untracked files
- snapshot_merge_with_env(
- "merge_with_untracked_files",
- repo,
- &["main"],
- Some(&feature_wt),
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(repo, "merge", &["main"], Some(&feature_wt));
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
("WORKTRUNK_COMMIT_GENERATION__ARGS", "fix: commit changes"),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -542,12 +521,12 @@ fn test_merge_pre_merge_command_success(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes to skip approval prompts
- snapshot_merge(
- "merge_pre_merge_command_success",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -562,12 +541,12 @@ fn test_merge_pre_merge_command_failure(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes - pre-merge command should fail and block merge
- snapshot_merge(
- "merge_pre_merge_command_failure",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -582,12 +561,12 @@ fn test_merge_pre_merge_command_no_hooks(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --no-verify - should skip pre-merge commands and succeed
- snapshot_merge(
- "merge_pre_merge_command_no_hooks",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--no-verify"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -611,12 +590,12 @@ test = "exit 0"
let feature_wt = repo.add_feature();
// Merge with --yes - all pre-merge commands should pass
- snapshot_merge(
- "merge_pre_merge_command_named",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -635,12 +614,12 @@ fn test_merge_post_merge_command_success(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes
- snapshot_merge(
- "merge_post_merge_command_success",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// Verify the command ran in the main worktree (not the feature worktree)
let marker_file = repo.root_path().join("post-merge-ran.txt");
@@ -672,12 +651,12 @@ fn test_merge_post_merge_command_skipped_with_no_verify(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --no-verify - hook should be skipped entirely
- snapshot_merge(
- "merge_post_merge_command_no_verify",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes", "--no-verify"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// Verify the command did not run in the main worktree
let marker_file = repo.root_path().join("post-merge-ran.txt");
@@ -699,12 +678,12 @@ fn test_merge_post_merge_command_failure(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes - post-merge command should fail but merge should complete
- snapshot_merge(
- "merge_post_merge_command_failure",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -727,12 +706,12 @@ deploy = "echo 'Deploying branch {{ branch }}' > deploy.txt"
let feature_wt = repo.add_feature();
// Merge with --yes
- snapshot_merge(
- "merge_post_merge_command_named",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// Verify both commands ran
let notify_file = repo.root_path().join("notify.txt");
@@ -768,12 +747,12 @@ fn test_merge_post_merge_runs_with_nothing_to_merge(mut repo: TestRepo) {
let feature_wt = repo.add_worktree("feature");
// Merge with --yes - nothing to merge but post-merge should still run
- snapshot_merge(
- "merge_post_merge_runs_with_nothing_to_merge",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// Verify the post-merge command ran in the main worktree
let marker_file = repo.root_path().join("post-merge-ran.txt");
@@ -799,12 +778,7 @@ fn test_merge_post_merge_runs_from_main_branch(repo: TestRepo) {
repo.commit("Add config");
// Run merge from main branch (repo root) - nothing to merge
- snapshot_merge(
- "merge_post_merge_runs_from_main_branch",
- &repo,
- &["--yes"],
- None, // cwd = repo root = main branch
- );
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &["--yes"], None));
// Verify the post-merge command ran
let marker_file = repo.root_path().join("post-merge-ran.txt");
@@ -832,12 +806,12 @@ fn test_merge_pre_commit_command_success(mut repo: TestRepo) {
fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();
// Merge with --yes (changes uncommitted, should trigger pre-commit hook)
- snapshot_merge(
- "merge_pre_commit_command_success",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -854,12 +828,12 @@ fn test_merge_pre_commit_command_failure(mut repo: TestRepo) {
fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();
// Merge with --yes - pre-commit command should fail and block merge
- snapshot_merge(
- "merge_pre_commit_command_failure",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -879,12 +853,12 @@ fn test_merge_pre_squash_command_success(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes (squashing is now the default)
- snapshot_merge(
- "merge_pre_squash_command_success",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -899,12 +873,12 @@ fn test_merge_pre_squash_command_failure(mut repo: TestRepo) {
let feature_wt = repo.add_feature();
// Merge with --yes (squashing is default) - pre-commit command should fail and block merge
- snapshot_merge(
- "merge_pre_squash_command_failure",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--yes"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -913,7 +887,7 @@ fn test_merge_no_remote(#[from(repo_with_feature_worktree)] repo: TestRepo) {
let feature_wt = repo.worktree_path("feature");
// Try to merge without specifying target (should fail - no remote to get default branch)
- snapshot_merge("merge_no_remote", &repo, &[], Some(feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &[], Some(feature_wt)));
}
// README EXAMPLE GENERATION TESTS
@@ -931,11 +905,9 @@ fn test_merge_no_remote(#[from(repo_with_feature_worktree)] repo: TestRepo) {
#[rstest]
fn test_readme_example_simple(repo: TestRepo) {
// Snapshot the switch --create command (runs from bare repo)
- snapshot_switch(
+ assert_cmd_snapshot!(
"readme_example_simple_switch",
- &repo,
- &["--create", "fix-auth"],
- None,
+ make_snapshot_cmd(&repo, "switch", &["--create", "fix-auth"], None)
);
// Get the created worktree path and make a commit
@@ -960,7 +932,10 @@ pub fn refresh(refresh_token: &str) -> String {
repo.run_git_in(&feature_wt, &["commit", "-m", "Implement JWT validation"]);
// Snapshot the merge command
- snapshot_merge("readme_example_simple", &repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(
+ "readme_example_simple",
+ make_snapshot_cmd(&repo, "merge", &["main"], Some(&feature_wt))
+ );
}
/// Generate README example: Complex merge with multiple hooks
@@ -1141,13 +1116,11 @@ command = "{}"
"{}:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
bin_dir.display()
);
- snapshot_merge_with_env(
- "readme_example_complex",
- &repo,
- &["main", "--yes"],
- Some(&feature_wt),
- &[("PATH", &path_with_bin)],
- );
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "merge", &["main", "--yes"], Some(&feature_wt));
+ cmd.env("PATH", &path_with_bin);
+ cmd
+ });
}
/// Generate README example: Creating worktree with post-create and post-start hooks
@@ -1215,11 +1188,10 @@ fi
bin_dir.display()
);
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
+ assert_cmd_snapshot!("readme_example_hooks_post_create", {
let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "feature-x", "--yes"], None);
cmd.env("PATH", &path_with_bin);
- assert_cmd_snapshot!("readme_example_hooks_post_create", cmd);
+ cmd
});
}
@@ -1424,13 +1396,11 @@ command = "{}"
"{}:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
bin_dir.display()
);
- snapshot_merge_with_env(
- "readme_example_hooks_pre_merge",
- &repo,
- &["main", "--yes"],
- Some(&feature_wt),
- &[("PATH", &path_with_bin)],
- );
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "merge", &["main", "--yes"], Some(&feature_wt));
+ cmd.env("PATH", &path_with_bin);
+ cmd
+ });
}
#[rstest]
@@ -1439,28 +1409,12 @@ fn test_merge_no_commit_with_clean_tree(mut repo_with_feature_worktree: TestRepo
let feature_wt = &repo.worktrees["feature"];
// Merge with --no-commit (should succeed - clean tree)
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(
- repo,
- "merge",
- &["main", "--no-commit", "--no-remove"],
- Some(feature_wt),
- );
- assert_cmd_snapshot!(cmd, @r"
- success: true
- exit_code: 0
- ----- stdout -----
-
- ----- stderr -----
- ◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-   * fc12499 Add feature file
-   feature.txt | 1 +
-   1 file changed, 1 insertion(+)
- ✓ Merged to main (1 commit, 1 file, +1)
- ○ Worktree preserved (--no-remove)
- ");
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ repo,
+ "merge",
+ &["main", "--no-commit", "--no-remove"],
+ Some(feature_wt),
+ ));
}
#[rstest]
@@ -1477,20 +1431,12 @@ fn test_merge_no_commit_with_dirty_tree(mut repo: TestRepo) {
fs::write(feature_wt.join("uncommitted.txt"), "uncommitted content").unwrap();
// Try to merge with --no-commit (should fail - dirty tree)
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd =
- make_snapshot_cmd(&repo, "merge", &["main", "--no-commit"], Some(&feature_wt));
- assert_cmd_snapshot!(cmd, @"
- success: false
- exit_code: 1
- ----- stdout -----
-
- ----- stderr -----
- ✗ Cannot merge with --no-commit: feature has uncommitted changes
- ↳ Commit or stash changes first
- ");
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "merge",
+ &["main", "--no-commit"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1499,28 +1445,12 @@ fn test_merge_no_commit_no_squash_no_remove_redundant(mut repo_with_feature_work
let feature_wt = &repo.worktrees["feature"];
// Merge with --no-commit --no-squash --no-remove (redundant but valid - should succeed)
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(
- repo,
- "merge",
- &["main", "--no-commit", "--no-squash", "--no-remove"],
- Some(feature_wt),
- );
- assert_cmd_snapshot!(cmd, @r"
- success: true
- exit_code: 0
- ----- stdout -----
-
- ----- stderr -----
- ◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-   * fc12499 Add feature file
-   feature.txt | 1 +
-   1 file changed, 1 insertion(+)
- ✓ Merged to main (1 commit, 1 file, +1)
- ○ Worktree preserved (--no-remove)
- ");
- });
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ repo,
+ "merge",
+ &["main", "--no-commit", "--no-squash", "--no-remove"],
+ Some(feature_wt),
+ ));
}
#[rstest]
@@ -1531,7 +1461,12 @@ fn test_merge_no_commits(mut repo_with_main_worktree: TestRepo) {
let feature_wt = repo.add_worktree("no-commits");
// Merge without any commits - should skip both squashing and rebasing
- snapshot_merge("merge_no_commits", repo, &["main"], Some(&feature_wt));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ repo,
+ "merge",
+ &["main"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1543,12 +1478,12 @@ fn test_merge_no_commits_with_changes(mut repo_with_main_worktree: TestRepo) {
fs::write(feature_wt.join("newfile.txt"), "new content").unwrap();
// Merge - should commit the changes, skip squashing (only 1 commit), and skip rebasing (at merge base)
- snapshot_merge(
- "merge_no_commits_with_changes",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1565,12 +1500,12 @@ fn test_merge_rebase_fast_forward(mut repo: TestRepo) {
repo.run_git(&["commit", "-m", "Update main"]);
// Merge - should fast-forward (no commits to replay)
- snapshot_merge(
- "merge_rebase_fast_forward",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1592,12 +1527,12 @@ fn test_merge_rebase_true_rebase(mut repo: TestRepo) {
repo.run_git(&["commit", "-m", "Update main"]);
// Merge - should show rebasing progress (has commits to replay)
- snapshot_merge(
- "merge_rebase_true_rebase",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
// =============================================================================
@@ -1609,12 +1544,12 @@ fn test_merge_no_rebase_when_already_rebased(merge_scenario: (TestRepo, PathBuf)
// Feature branch is based on main (no divergence), so --no-rebase should succeed
let (repo, feature_wt) = merge_scenario;
- snapshot_merge(
- "merge_no_rebase_already_rebased",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--no-rebase"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1633,12 +1568,12 @@ fn test_merge_no_rebase_when_not_rebased(mut repo: TestRepo) {
repo.run_git(&["commit", "-m", "Update main"]);
// --no-rebase should fail because feature is not rebased onto main
- snapshot_merge(
- "merge_no_rebase_not_rebased",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main", "--no-rebase"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1654,12 +1589,12 @@ fn test_merge_primary_on_different_branch(mut repo: TestRepo) {
"Add feature file",
);
- snapshot_merge(
- "merge_primary_on_different_branch",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// Verify primary stayed on develop (we don't switch branches, only worktrees)
assert_eq!(repo.current_branch(), "develop");
@@ -1698,12 +1633,12 @@ fn test_merge_primary_on_different_branch_dirty(mut repo: TestRepo) {
);
// Try to merge to main - should fail because primary has uncommitted changes that conflict
- snapshot_merge(
- "merge_primary_on_different_branch_dirty",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1712,12 +1647,12 @@ fn test_merge_race_condition_commit_after_push(mut repo_with_feature_worktree: T
let feature_wt = repo.worktrees["feature"].clone();
// Merge to main (this pushes the branch to main)
- snapshot_merge(
- "merge_race_condition_before_new_commit",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main", "--no-remove"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
// RACE CONDITION: Simulate another developer adding a commit to the feature branch
// after the merge/push but before worktree removal and branch deletion.
@@ -1823,12 +1758,12 @@ fn test_merge_to_non_default_target(repo: TestRepo) {
// Merge to staging explicitly (NOT to main)
// This should rebase onto staging (which has staging-file.txt)
// NOT onto main (which has main-file.txt)
- snapshot_merge(
- "merge_to_non_default_target",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "merge",
&["staging"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -1853,16 +1788,16 @@ fn test_merge_squash_with_working_tree_creates_backup(mut repo_with_main_worktre
// Merge with squash (default behavior)
// This should create a backup before squashing because there are uncommitted changes
- snapshot_merge_with_env(
- "merge_squash_with_working_tree_creates_backup",
- repo,
- &["main"],
- Some(&feature_wt),
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(repo, "merge", &["main"], Some(&feature_wt));
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
("WORKTRUNK_COMMIT_GENERATION__ARGS", "fix: update files"),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
// Verify that a backup was created in the reflog
// Note: The worktree has been removed by the merge, so we check from the repo root
@@ -1885,7 +1820,7 @@ fn test_merge_when_default_branch_missing_worktree(repo: TestRepo) {
// Move primary off default branch so no worktree holds it
repo.switch_primary_to("develop");
- snapshot_merge("merge_default_branch_missing_worktree", &repo, &[], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &[], None));
}
#[rstest]
@@ -1926,44 +1861,6 @@ fn test_merge_does_not_permanently_set_receive_deny_current_branch(
);
}
-/// Helper to snapshot step squash with env vars
-fn snapshot_step_squash_with_env(
- test_name: &str,
- repo: &TestRepo,
- args: &[&str],
- cwd: Option<&Path>,
- env_vars: &[(&str, &str)],
-) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "step", &[], cwd);
- cmd.arg("squash").args(args);
- for (key, value) in env_vars {
- cmd.env(key, value);
- }
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
-/// Helper to snapshot step commit command
-fn snapshot_step_commit_with_env(
- test_name: &str,
- repo: &TestRepo,
- args: &[&str],
- cwd: Option<&Path>,
- env_vars: &[(&str, &str)],
-) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "step", &[], cwd);
- cmd.arg("commit").args(args);
- for (key, value) in env_vars {
- cmd.env(key, value);
- }
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
#[rstest]
fn test_step_squash_with_no_verify_flag(mut repo: TestRepo) {
// Create a feature worktree with multiple commits
@@ -1987,19 +1884,20 @@ fn test_step_squash_with_no_verify_flag(mut repo: TestRepo) {
repo.run_git_in(&feature_wt, &["add", "file2.txt"]);
repo.run_git_in(&feature_wt, &["commit", "-m", "feat: add file 2"]);
- snapshot_step_squash_with_env(
- "step_squash_no_verify",
- &repo,
- &["--no-verify"],
- Some(&feature_wt),
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], Some(&feature_wt));
+ cmd.arg("squash").args(["--no-verify"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
(
"WORKTRUNK_COMMIT_GENERATION__ARGS",
"squash: combined commits",
),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -2017,19 +1915,20 @@ fn test_step_squash_with_stage_tracked_flag(mut repo: TestRepo) {
// Add uncommitted tracked changes
fs::write(feature_wt.join("file1.txt"), "updated content").expect("Failed to write file");
- snapshot_step_squash_with_env(
- "step_squash_stage_tracked",
- &repo,
- &["--stage=tracked"],
- Some(&feature_wt),
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], Some(&feature_wt));
+ cmd.arg("squash").args(["--stage=tracked"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
(
"WORKTRUNK_COMMIT_GENERATION__ARGS",
"squash: combined commits",
),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -2056,19 +1955,20 @@ fn test_step_squash_with_both_flags(mut repo: TestRepo) {
fs::write(feature_wt.join("file1.txt"), "updated content").expect("Failed to write file");
- snapshot_step_squash_with_env(
- "step_squash_both_flags",
- &repo,
- &["--no-verify", "--stage=tracked"],
- Some(&feature_wt),
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], Some(&feature_wt));
+ cmd.arg("squash").args(["--no-verify", "--stage=tracked"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
(
"WORKTRUNK_COMMIT_GENERATION__ARGS",
"squash: combined commits",
),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -2078,7 +1978,12 @@ fn test_step_squash_no_commits(mut repo: TestRepo) {
// Create a feature worktree but don't add any commits
let feature_wt = repo.add_worktree("feature");
- snapshot_step_squash_with_env("step_squash_no_commits", &repo, &[], Some(&feature_wt), &[]);
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "step",
+ &["squash"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -2089,13 +1994,12 @@ fn test_step_squash_single_commit(mut repo: TestRepo) {
let feature_wt =
repo.add_worktree_with_commit("feature", "file1.txt", "content 1", "feat: single commit");
- snapshot_step_squash_with_env(
- "step_squash_single_commit",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
- &[],
- Some(&feature_wt),
- &[],
- );
+ "step",
+ &["squash"],
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -2110,16 +2014,17 @@ fn test_step_commit_with_no_verify_flag(repo: TestRepo) {
fs::write(repo.root_path().join("file1.txt"), "content 1").expect("Failed to write file");
- snapshot_step_commit_with_env(
- "step_commit_no_verify",
- &repo,
- &["--no-verify"],
- None,
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], None);
+ cmd.arg("commit").args(["--no-verify"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
("WORKTRUNK_COMMIT_GENERATION__ARGS", "feat: add file"),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -2134,19 +2039,20 @@ fn test_step_commit_with_stage_tracked_flag(repo: TestRepo) {
)
.expect("Failed to write file");
- snapshot_step_commit_with_env(
- "step_commit_stage_tracked",
- &repo,
- &["--stage=tracked"],
- None,
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], None);
+ cmd.arg("commit").args(["--stage=tracked"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
(
"WORKTRUNK_COMMIT_GENERATION__ARGS",
"fix: update tracked file",
),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
@@ -2164,34 +2070,36 @@ fn test_step_commit_with_both_flags(repo: TestRepo) {
fs::write(repo.root_path().join("tracked.txt"), "modified").expect("Failed to write file");
- snapshot_step_commit_with_env(
- "step_commit_both_flags",
- &repo,
- &["--no-verify", "--stage=tracked"],
- None,
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], None);
+ cmd.arg("commit").args(["--no-verify", "--stage=tracked"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
("WORKTRUNK_COMMIT_GENERATION__ARGS", "fix: update file"),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
#[rstest]
fn test_step_commit_nothing_to_commit(repo: TestRepo) {
// No changes made - commit should fail with "nothing to commit"
- snapshot_step_commit_with_env(
- "step_commit_nothing_to_commit",
- &repo,
- &["--stage=none"],
- None,
- &[
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], None);
+ cmd.arg("commit").args(["--stage=none"]);
+ for (key, value) in &[
("WORKTRUNK_COMMIT_GENERATION__COMMAND", "echo"),
(
"WORKTRUNK_COMMIT_GENERATION__ARGS",
"feat: this should fail",
),
- ],
- );
+ ] {
+ cmd.env(key, value);
+ }
+ cmd
+ });
}
// =============================================================================
@@ -2210,12 +2118,12 @@ fn test_merge_error_uncommitted_changes_with_no_commit(mut repo_with_main_worktr
fs::write(feature_wt.join("dirty.txt"), "uncommitted content").unwrap();
// Try to merge with --no-commit - should fail because working tree is dirty
- snapshot_merge(
- "merge_error_uncommitted_changes_no_commit",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main", "--no-commit", "--no-remove"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
#[rstest]
@@ -2245,12 +2153,12 @@ fn test_merge_error_conflicting_changes_in_target(mut repo_with_alternate_primar
.unwrap();
// Try to merge - should fail because of conflicting uncommitted changes
- snapshot_merge(
- "merge_error_conflicting_changes",
+ assert_cmd_snapshot!(make_snapshot_cmd(
repo,
+ "merge",
&["main"],
- Some(&feature_wt),
- );
+ Some(&feature_wt)
+ ));
}
// =============================================================================
@@ -2264,25 +2172,23 @@ fn test_step_commit_show_prompt(repo: TestRepo) {
repo.git_command().args(["add", "new_file.txt"]);
// The prompt should be written to stdout
- snapshot_step_commit_with_env(
- "step_commit_show_prompt",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
- &["--show-prompt"],
- None,
- &[],
- );
+ "step",
+ &["commit", "--show-prompt"],
+ None
+ ));
}
#[rstest]
fn test_step_commit_show_prompt_no_staged_changes(repo: TestRepo) {
// No staged changes - should still output the prompt (with empty diff)
- snapshot_step_commit_with_env(
- "step_commit_show_prompt_no_staged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
- &["--show-prompt"],
- None,
- &[],
- );
+ "step",
+ &["commit", "--show-prompt"],
+ None
+ ));
}
#[rstest]
@@ -2293,29 +2199,18 @@ fn test_step_squash_show_prompt(repo_with_multi_commit_feature: TestRepo) {
let feature_wt = repo.worktree_path("feature");
// Should output the squash prompt with commits and diff
- snapshot_step_squash_with_env(
- "step_squash_show_prompt",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
- &["--show-prompt"],
- Some(feature_wt),
- &[],
- );
+ "step",
+ &["squash", "--show-prompt"],
+ Some(feature_wt)
+ ));
}
// =============================================================================
// step rebase tests
// =============================================================================
-/// Helper to snapshot step rebase command
-fn snapshot_step_rebase(test_name: &str, repo: &TestRepo, args: &[&str], cwd: Option<&Path>) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd(repo, "step", &[], cwd);
- cmd.arg("rebase").args(args);
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
/// Test that step rebase correctly handles merge commits.
///
/// When a branch has merged main into it, the merge-base equals main's HEAD,
@@ -2350,10 +2245,9 @@ fn test_step_rebase_with_merge_commit(mut repo: TestRepo) {
);
// Now step rebase should linearize the history (not report "Already up-to-date")
- snapshot_step_rebase(
- "step_rebase_with_merge_commit",
- &repo,
- &["main"],
- Some(&feature_wt),
- );
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "step", &[], Some(&feature_wt));
+ cmd.arg("rebase").args(["main"]);
+ cmd
+ });
}
diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rs
index 281ca5dc7..8cf5de92d 100644
--- a/tests/integration_tests/remove.rs
+++ b/tests/integration_tests/remove.rs
@@ -7,49 +7,10 @@ use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
use std::time::Duration;
-/// Helper to create snapshot with normalized paths
-fn snapshot_remove(test_name: &str, repo: &TestRepo, args: &[&str], cwd: Option<&std::path::Path>) {
- snapshot_remove_impl(test_name, repo, args, cwd, false);
-}
-
-/// Helper to create snapshot with directive file (simulates shell wrapper)
-fn snapshot_remove_with_directive_file(
- test_name: &str,
- repo: &TestRepo,
- args: &[&str],
- cwd: Option<&std::path::Path>,
-) {
- snapshot_remove_impl(test_name, repo, args, cwd, true);
-}
-
-fn snapshot_remove_impl(
- test_name: &str,
- repo: &TestRepo,
- args: &[&str],
- cwd: Option<&std::path::Path>,
- with_directive_file: bool,
-) {
- let settings = setup_snapshot_settings(repo);
- settings.bind(|| {
- // Directive file guard - declared at closure scope to live through command execution
- let maybe_directive = if with_directive_file {
- Some(directive_file())
- } else {
- None
- };
-
- let mut cmd = make_snapshot_cmd(repo, "remove", args, cwd);
- if let Some((ref directive_path, ref _guard)) = maybe_directive {
- configure_directive_file(&mut cmd, directive_path);
- }
- assert_cmd_snapshot!(test_name, cmd);
- });
-}
-
#[rstest]
fn test_remove_already_on_default(repo: TestRepo) {
// Already on main branch
- snapshot_remove("remove_already_on_default", &repo, &[], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
}
#[rstest]
@@ -57,7 +18,7 @@ fn test_remove_switch_to_default(repo: TestRepo) {
// Create and switch to a feature branch in the main repo
repo.run_git(&["switch", "-c", "feature"]);
- snapshot_remove("remove_switch_to_default", &repo, &[], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
}
#[rstest]
@@ -65,14 +26,25 @@ fn test_remove_from_worktree(mut repo: TestRepo) {
let worktree_path = repo.add_worktree("feature-wt");
// Run remove from within the worktree
- snapshot_remove("remove_from_worktree", &repo, &[], Some(&worktree_path));
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "remove",
+ &[],
+ Some(&worktree_path)
+ ));
}
#[rstest]
fn test_remove_internal_mode(mut repo: TestRepo) {
let worktree_path = repo.add_worktree("feature-internal");
- snapshot_remove_with_directive_file("remove_internal_mode", &repo, &[], Some(&worktree_path));
+ // Directive file guard must live through command execution
+ let (directive_path, _guard) = directive_file();
+ assert_cmd_snapshot!({
+ let mut cmd = make_snapshot_cmd(&repo, "remove", &[], Some(&worktree_path));
+ configure_directive_file(&mut cmd, &directive_path);
+ cmd
+ });
}
/// Test remove when running as a git subcommand (`git wt remove` instead of `wt remove`).
@@ -98,7 +70,7 @@ fn test_remove_dirty_working_tree(repo: TestRepo) {
// Create a dirty file
std::fs::write(repo.root_path().join("dirty.txt"), "uncommitted changes").unwrap();
- snapshot_remove("remove_dirty_working_tree", &repo, &[], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
}
#[rstest]
@@ -107,7 +79,7 @@ fn test_remove_by_name_from_main(mut repo: TestRepo) {
let _worktree_path = repo.add_worktree("feature-a");
// Remove it by name from main repo
- snapshot_remove("remove_by_name_from_main", &repo, &["feature-a"], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["feature-a"], None));
}
#[rstest]
@@ -117,12 +89,12 @@ fn test_remove_by_name_from_other_worktree(mut repo: TestRepo) {
let _worktree_b = repo.add_worktree("feature-b");
// From worktree A, remove worktree B by name
- snapshot_remove(
- "remove_by_name_from_other_worktree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-b"],
- Some(&worktree_a),
- );
+ Some(&worktree_a)
+ ));
}
#[rstest]
@@ -130,18 +102,18 @@ fn test_remove_current_by_name(mut repo: TestRepo) {
let worktree_path = repo.add_worktree("feature-current");
// Remove current worktree by specifying its name
- snapshot_remove(
- "remove_current_by_name",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-current"],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
}
#[rstest]
fn test_remove_nonexistent_worktree(repo: TestRepo) {
// Try to remove a worktree that doesn't exist
- snapshot_remove("remove_nonexistent_worktree", &repo, &["nonexistent"], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["nonexistent"], None));
}
/// Test removing a branch that exists but has no worktree, when expected path is occupied.
@@ -201,23 +173,18 @@ fn test_remove_branch_no_worktree_path_occupied(mut repo: TestRepo) {
// Now: branch `npm` exists, no worktree for it, but npm's expected path has `other` branch
// Running `wt remove npm` should show "No worktree found" NOT "Cannot create worktree"
- snapshot_remove(
- "remove_branch_no_worktree_path_occupied",
- &repo,
- &["npm"],
- None,
- );
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["npm"], None));
}
#[rstest]
fn test_remove_multiple_nonexistent_force(repo: TestRepo) {
// Try to force-remove multiple branches that don't exist
- snapshot_remove(
- "remove_multiple_nonexistent_force",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["-D", "foo", "bar", "baz"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -229,18 +196,18 @@ fn test_remove_remote_only_branch(#[from(repo_with_remote)] repo: TestRepo) {
repo.run_git(&["fetch", "origin"]);
// Try to remove a branch that only exists on remote - should get helpful error
- snapshot_remove(
- "remove_remote_only_branch",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["remote-feature"],
- None,
- );
+ None
+ ));
}
#[rstest]
fn test_remove_nonexistent_branch(repo: TestRepo) {
// Try to remove a branch that doesn't exist at all
- snapshot_remove("remove_nonexistent_branch", &repo, &["nonexistent"], None);
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["nonexistent"], None));
}
#[rstest]
@@ -250,12 +217,12 @@ fn test_remove_partial_success(mut repo: TestRepo) {
// Try to remove both the valid worktree and a nonexistent one
// The valid one should be removed; error for nonexistent; exit with failure
- snapshot_remove(
- "remove_partial_success",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature", "nonexistent"],
- None,
- );
+ None
+ ));
// Verify the valid worktree was actually removed
let worktrees_dir = repo.root_path().parent().unwrap();
@@ -273,12 +240,7 @@ fn test_remove_by_name_dirty_target(mut repo: TestRepo) {
std::fs::write(worktree_path.join("dirty.txt"), "uncommitted changes").unwrap();
// Try to remove it by name from main repo
- snapshot_remove(
- "remove_by_name_dirty_target",
- &repo,
- &["feature-dirty"],
- None,
- );
+ assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["feature-dirty"], None));
}
#[rstest]
@@ -289,12 +251,12 @@ fn test_remove_multiple_worktrees(mut repo: TestRepo) {
let _worktree_c = repo.add_worktree("feature-c");
// Remove all three at once from main repo
- snapshot_remove(
- "remove_multiple_worktrees",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-a", "feature-b", "feature-c"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -305,12 +267,12 @@ fn test_remove_multiple_including_current(mut repo: TestRepo) {
let _worktree_c = repo.add_worktree("feature-c");
// From worktree A, remove all three (including current)
- snapshot_remove(
- "remove_multiple_including_current",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-a", "feature-b", "feature-c"],
- Some(&worktree_a),
- );
+ Some(&worktree_a)
+ ));
}
#[rstest]
@@ -333,12 +295,12 @@ fn test_remove_branch_not_fully_merged(mut repo: TestRepo) {
// Try to remove it from the main repo
// Branch deletion should fail but worktree removal should succeed
- snapshot_remove(
- "remove_branch_not_fully_merged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-unmerged"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -347,12 +309,12 @@ fn test_remove_foreground(mut repo: TestRepo) {
let _worktree_path = repo.add_worktree("feature-fg");
// Remove it with --no-background flag from main repo
- snapshot_remove(
- "remove_foreground",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "feature-fg"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -375,12 +337,12 @@ fn test_remove_foreground_unmerged(mut repo: TestRepo) {
// Remove it with --no-background flag from main repo
// Branch deletion should fail but worktree removal should succeed
- snapshot_remove(
- "remove_foreground_unmerged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "feature-unmerged-fg"],
- None,
- );
+ None
+ ));
}
/// Tests foreground removal with --no-delete-branch on an integrated branch.
@@ -391,12 +353,12 @@ fn test_remove_foreground_no_delete_branch(mut repo: TestRepo) {
let _worktree_path = repo.add_worktree("feature-fg-keep");
// Remove with both --no-background and --no-delete-branch
- snapshot_remove(
- "remove_foreground_no_delete_branch",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "--no-delete-branch", "feature-fg-keep"],
- None,
- );
+ None
+ ));
}
/// Tests foreground removal with --no-delete-branch on an unmerged branch.
@@ -429,16 +391,16 @@ fn test_remove_foreground_no_delete_branch_unmerged(mut repo: TestRepo) {
// No hint because:
// - Branch is unmerged (wouldn't be deleted anyway)
// - --no-delete-branch had no effect
- snapshot_remove(
- "remove_foreground_no_delete_branch_unmerged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&[
"--no-background",
"--no-delete-branch",
"feature-fg-unmerged-keep",
],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -448,12 +410,12 @@ fn test_remove_no_delete_branch(mut repo: TestRepo) {
// Remove worktree but keep the branch using --no-delete-branch flag
// Since branch is integrated, the flag has an effect - hint explains this
- snapshot_remove(
- "remove_no_delete_branch",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-delete-branch", "feature-keep"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -482,12 +444,12 @@ fn test_remove_no_delete_branch_unmerged(mut repo: TestRepo) {
// Remove worktree with --no-delete-branch flag
// Since branch is unmerged, the flag has no effect - no hint shown
- snapshot_remove(
- "remove_no_delete_branch_unmerged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-delete-branch", "feature-unmerged-keep"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -499,12 +461,12 @@ fn test_remove_branch_only_merged(repo: TestRepo) {
.unwrap();
// Remove the branch (no worktree exists)
- snapshot_remove(
- "remove_branch_only_merged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-merged"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -536,12 +498,12 @@ fn test_remove_branch_only_unmerged(repo: TestRepo) {
// Try to remove the branch (no worktree exists, branch not merged)
// Branch deletion should fail but not error
- snapshot_remove(
- "remove_branch_only_unmerged",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-unmerged"],
- None,
- );
+ None
+ ));
}
#[rstest]
@@ -572,12 +534,12 @@ fn test_remove_branch_only_force_delete(repo: TestRepo) {
.unwrap();
// Force delete the branch (no worktree exists)
- snapshot_remove(
- "remove_branch_only_force_delete",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--force-delete", "feature-force"],
- None,
- );
+ None
+ ));
}
/// Test that remove works from a detached HEAD state in a worktree.
@@ -592,12 +554,12 @@ fn test_remove_from_detached_head_in_worktree(mut repo: TestRepo) {
repo.detach_head_in_worktree("feature-detached");
// Run remove from within the detached worktree (should still work)
- snapshot_remove(
- "remove_from_detached_head_in_worktree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&[],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
}
/// Test foreground removal from a detached HEAD state.
@@ -615,12 +577,12 @@ fn test_remove_foreground_detached_head(mut repo: TestRepo) {
repo.detach_head_in_worktree("feature-detached-fg");
// Run foreground remove from within the detached worktree
- snapshot_remove(
- "remove_foreground_detached_head",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background"],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
}
/// Test that `wt remove @` works from a detached HEAD state in a worktree.
@@ -635,12 +597,12 @@ fn test_remove_at_from_detached_head_in_worktree(mut repo: TestRepo) {
repo.detach_head_in_worktree("feature-detached-at");
// Run `wt remove @` from within the detached worktree (should behave same as no args)
- snapshot_remove(
- "remove_at_from_detached_head_in_worktree",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["@"],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
}
/// Test that a branch with matching tree content (but not an ancestor) is deleted.
@@ -723,12 +685,12 @@ fn test_remove_branch_matching_tree_content(repo: TestRepo) {
);
// Remove the branch - should succeed because tree content matches main
- snapshot_remove(
- "remove_branch_matching_tree_content",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-squashed"],
- None,
- );
+ None
+ ));
}
/// Test the explicit difference between removing main worktree (error) vs linked worktree (success).
///
@@ -748,40 +710,32 @@ fn test_remove_main_worktree_vs_linked_worktree(mut repo: TestRepo) {
// Part 1: Verify linked worktree CAN be removed (from within it)
// Use --no-background to ensure removal completes before creating next worktree
- snapshot_remove(
+ assert_cmd_snapshot!(
"remove_main_vs_linked__from_linked_succeeds",
- &repo,
- &["--no-background"],
- Some(&linked_wt_path),
+ make_snapshot_cmd(&repo, "remove", &["--no-background"], Some(&linked_wt_path))
);
// Part 2: Recreate the linked worktree for the next test
let _linked_wt_path = repo.add_worktree("feature2");
// Part 3: Verify linked worktree CAN be removed (from main, by name)
- snapshot_remove(
+ assert_cmd_snapshot!(
"remove_main_vs_linked__from_main_by_name_succeeds",
- &repo,
- &["feature2"],
- None,
+ make_snapshot_cmd(&repo, "remove", &["feature2"], None)
);
// Part 4: Verify main worktree CANNOT be removed (from main, on default branch)
- snapshot_remove(
+ assert_cmd_snapshot!(
"remove_main_vs_linked__main_on_default_fails",
- &repo,
- &[],
- None,
+ make_snapshot_cmd(&repo, "remove", &[], None)
);
// Part 5: Create a feature branch IN the main worktree, verify STILL cannot remove
repo.run_git(&["switch", "-c", "feature-in-main"]);
- snapshot_remove(
+ assert_cmd_snapshot!(
"remove_main_vs_linked__main_on_feature_fails",
- &repo,
- &[],
- None,
+ make_snapshot_cmd(&repo, "remove", &[], None)
);
// Part 6: Verify main worktree CANNOT be removed by name from a linked worktree
@@ -789,11 +743,9 @@ fn test_remove_main_worktree_vs_linked_worktree(mut repo: TestRepo) {
repo.run_git(&["switch", "main"]);
let linked_for_test = repo.add_worktree("test-from-linked");
- snapshot_remove(
+ assert_cmd_snapshot!(
"remove_main_vs_linked__main_by_name_from_linked_fails",
- &repo,
- &["main"],
- Some(&linked_for_test),
+ make_snapshot_cmd(&repo, "remove", &["main"], Some(&linked_for_test))
);
}
@@ -922,12 +874,12 @@ fn test_remove_squash_merged_then_main_advanced(repo: TestRepo) {
// Remove the feature branch - should succeed because content is integrated
// (detected via merge simulation using git merge-tree)
- snapshot_remove(
- "remove_squash_merged_then_main_advanced",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["feature-squash"],
- None,
- );
+ None
+ ));
}
// ============================================================================
@@ -952,12 +904,12 @@ approved-commands = ["echo 'About to remove worktree'"]
let _worktree_path = repo.add_worktree("feature-hook");
// Remove with --no-background to ensure synchronous execution
- snapshot_remove(
- "pre_remove_hook_executes",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "feature-hook"],
- None,
- );
+ None
+ ));
}
/// Test pre-remove hook has access to template variables.
@@ -988,12 +940,12 @@ approved-commands = [
let _worktree_path = repo.add_worktree("feature-templates");
// Remove with --no-background
- snapshot_remove(
- "pre_remove_hook_template_variables",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "feature-templates"],
- None,
- );
+ None
+ ));
}
/// Test pre-remove hook runs even in background mode (before spawning background process).
@@ -1060,12 +1012,12 @@ approved-commands = ["exit 1"]
let worktree_path = repo.add_worktree("feature-fail");
// Remove - should FAIL due to hook failure
- snapshot_remove(
- "pre_remove_hook_failure_aborts",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "feature-fail"],
- None,
- );
+ None
+ ));
// Verify worktree was NOT removed (hook failure aborted removal)
assert!(
@@ -1147,12 +1099,12 @@ approved-commands = ["echo 'hook ran' > {}"]
let worktree_path = repo.add_worktree("feature-skip");
// Remove with --no-verify to skip hooks
- snapshot_remove(
- "pre_remove_hook_skipped_with_no_verify",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background", "--no-verify", "feature-skip"],
- None,
- );
+ None
+ ));
// Wait for any potential hook execution (absence check - can't poll, use 500ms per guidelines)
thread::sleep(Duration::from_millis(500));
@@ -1205,12 +1157,12 @@ approved-commands = ["touch {marker_path}"]
repo.detach_head_in_worktree("feature-detached-hook");
// Remove with --no-background to ensure synchronous execution
- snapshot_remove(
- "pre_remove_hook_runs_for_detached_head",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&["--no-background"],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
// Marker file should exist - hook ran
assert!(
@@ -1247,12 +1199,12 @@ approved-commands = ["touch {marker_path}"]
repo.detach_head_in_worktree("feature-detached-bg");
// Remove in background mode (default)
- snapshot_remove(
- "pre_remove_hook_runs_for_detached_head_background",
+ assert_cmd_snapshot!(make_snapshot_cmd(
&repo,
+ "remove",
&[],
- Some(&worktree_path),
- );
+ Some(&worktree_path)
+ ));
// Marker file should exist - hook ran before background spawn
assert!(
diff --git a/tests/integration_tests/statusline.rs b/tests/integration_tests/statusline.rs
index 0dcd73509..f4507e11c 100644
--- a/tests/integration_tests/statusline.rs
+++ b/tests/integration_tests/statusline.rs
@@ -118,23 +118,26 @@ fn test_statusline_commits_ahead(mut repo: TestRepo) {
// Run from the feature worktree to see commits ahead
let feature_path = repo.worktree_path("feature");
let output = run_statusline_from_dir(&repo, &[], None, feature_path);
- assert_snapshot!(output, @" feature ↑ ↑2 ^+2");
+ assert_snapshot!(output, @" feature ↑ ↑2 ^+2");
}
// --- Claude Code Mode Tests ---
-/// Create snapshot settings that filter the dynamic temp path
-fn claude_code_snapshot_settings(repo: &TestRepo) -> insta::Settings {
+/// Create snapshot settings that normalize path output for statusline tests.
+///
+/// The statusline output varies by platform:
+/// - Linux: Raw path is filtered by auto-bound settings to `_REPO_`
+/// - macOS: Fish-style abbreviation (e.g., `/p/v/f/.../repo`) bypasses auto-bound filters
+///
+/// This function normalizes both cases to a consistent `[PATH]` placeholder.
+fn claude_code_snapshot_settings() -> insta::Settings {
let mut settings = insta::Settings::clone_current();
- // The path gets fish-style abbreviated, so filter the abbreviated form
- // e.g., /private/var/folders/.../repo -> /p/v/f/.../repo
- // We replace everything up to "repo" with [PATH]
- settings.add_filter(r"(?m)^.*repo", "[PATH]");
- // Also filter the raw path in case it appears
- settings.add_filter(
- &regex::escape(&repo.root_path().display().to_string()),
- "[PATH]",
- );
+ // Normalize _REPO_ (from auto-bound filters on Linux) to [PATH]
+ settings.add_filter(r"_REPO_", "[PATH]");
+ // Normalize fish-abbreviated paths (on macOS) to [PATH]
+ settings.add_filter(r"/[a-zA-Z0-9/._-]+/repo", "[PATH]");
+ // Strip leading ANSI reset code if present (output starts with [0m)
+ settings.add_filter(r"^\x1b\[0m ", "");
settings
}
@@ -166,7 +169,7 @@ fn test_statusline_claude_code_full_context(repo: TestRepo) {
);
let output = run_statusline(&repo, &["--claude-code"], Some(&json));
- claude_code_snapshot_settings(&repo).bind(|| {
+ claude_code_snapshot_settings().bind(|| {
assert_snapshot!(output, @"[PATH] main ?^ | Opus");
});
}
@@ -177,7 +180,7 @@ fn test_statusline_claude_code_minimal(repo: TestRepo) {
let json = format!(r#"{{"workspace": {{"current_dir": "{escaped_path}"}}}}"#,);
let output = run_statusline(&repo, &["--claude-code"], Some(&json));
- claude_code_snapshot_settings(&repo).bind(|| {
+ claude_code_snapshot_settings().bind(|| {
assert_snapshot!(output, @"[PATH] main ^");
});
}
@@ -193,7 +196,7 @@ fn test_statusline_claude_code_with_model(repo: TestRepo) {
);
let output = run_statusline(&repo, &["--claude-code"], Some(&json));
- claude_code_snapshot_settings(&repo).bind(|| {
+ claude_code_snapshot_settings().bind(|| {
assert_snapshot!(output, @"[PATH] main ^ | Haiku");
});
}
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
similarity index 94%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
index 75245d9eb..f2942f409 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
@@ -7,10 +7,10 @@ y
▲ repo needs approval to execute 1 command:
○ post-create:
-  echo 'test command'
+  echo 'test command'
❯ Allow and remember? [y/N]
◎ Running post-create project hook:
-  echo 'test command'
+  echo 'test command'
test command
✓ Created new worktree for test-approve from main @ _REPO_/repo.BRANCH
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
similarity index 97%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
index 09efbf9ef..a7d7c95c5 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
@@ -7,7 +7,7 @@ n
▲ repo needs approval to execute 1 command:
○ post-create:
-  echo 'test command'
+  echo 'test command'
❯ Allow and remember? [y/N]
○ Commands declined, continuing worktree creation
✓ Created new worktree for test-decline from main @ _REPO_/repo.BRANCH
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
similarity index 92%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
index 93c016800..703089334 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
@@ -7,18 +7,18 @@ y
▲ repo needs approval to execute 2 commands:
○ post-create first:
-  echo 'First command'
+  echo 'First command'
○ post-create third:
-  echo 'Third command'
+  echo 'Third command'
❯ Allow and remember? [y/N]
◎ Running post-create project:first:
-  echo 'First command'
+  echo 'First command'
First command
◎ Running post-create project:second:
-  echo 'Second command'
+  echo 'Second command'
Second command
◎ Running post-create project:third:
-  echo 'Third command'
+  echo 'Third command'
Third command
✓ Created new worktree for test-mixed-accept from main @ _REPO_/repo.BRANCH
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
similarity index 94%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
index 001875ca2..9f1f3da77 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
@@ -7,9 +7,9 @@ n
▲ repo needs approval to execute 2 commands:
○ post-create first:
-  echo 'First command'
+  echo 'First command'
○ post-create third:
-  echo 'Third command'
+  echo 'Third command'
❯ Allow and remember? [y/N]
○ Commands declined, continuing worktree creation
✓ Created new worktree for test-mixed-decline from main @ _REPO_/repo.BRANCH
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
similarity index 91%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
index 1359ea040..b56d0ed1e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
@@ -7,20 +7,20 @@ y
▲ repo needs approval to execute 3 commands:
○ post-create first:
-  echo 'First command'
+  echo 'First command'
○ post-create second:
-  echo 'Second command'
+  echo 'Second command'
○ post-create third:
-  echo 'Third command'
+  echo 'Third command'
❯ Allow and remember? [y/N]
◎ Running post-create project:first:
-  echo 'First command'
+  echo 'First command'
First command
◎ Running post-create project:second:
-  echo 'Second command'
+  echo 'Second command'
Second command
◎ Running post-create project:third:
-  echo 'Third command'
+  echo 'Third command'
Third command
✓ Created new worktree for test-multi from main @ _REPO_/repo.BRANCH
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
similarity index 88%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
index 681b91c55..ed36a3bec 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
@@ -7,20 +7,20 @@ y
▲ repo needs approval to execute 3 commands:
○ post-create install:
-  echo 'Installing dependencies...'
+  echo 'Installing dependencies...'
○ post-create build:
-  echo 'Building project...'
+  echo 'Building project...'
○ post-create test:
-  echo 'Running tests...'
+  echo 'Running tests...'
❯ Allow and remember? [y/N]
◎ Running post-create project:install:
-  echo 'Installing dependencies...'
+  echo 'Installing dependencies...'
Installing dependencies...
◎ Running post-create project:build:
-  echo 'Building project...'
+  echo 'Building project...'
Building project...
◎ Running post-create project:test:
-  echo 'Running tests...'
+  echo 'Running tests...'
Running tests...
✓ Created new worktree for test-named from main @ _REPO_/repo.BRANCH
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
similarity index 95%
rename from tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
rename to tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
index adc19d237..b298178ed 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
@@ -7,12 +7,12 @@ y
▲ repo needs approval to execute 1 command:
○ post-create:
-  echo 'test command'
+  echo 'test command'
❯ Allow and remember? [y/N]
▲ Failed to save command approval: Failed to write config file: Permission denied (os error 13)
↳ Approval will be requested again next time.
◎ Running post-create project hook:
-  echo 'test command'
+  echo 'test command'
test command
✓ Created new worktree for test-permission from main @ _REPO_/repo.BRANCH
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_get_comprehensive.snap b/tests/snapshots/integration__integration_tests__config_state__state_get_comprehensive.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__config_state__state_get_comprehensive.snap
rename to tests/snapshots/integration__integration_tests__config_state__state_get_comprehensive.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_get_with_ci_entries.snap b/tests/snapshots/integration__integration_tests__config_state__state_get_with_ci_entries.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__config_state__state_get_with_ci_entries.snap
rename to tests/snapshots/integration__integration_tests__config_state__state_get_with_ci_entries.snap
diff --git a/tests/integration_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
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
rename to tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
diff --git a/tests/integration_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
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
rename to tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
diff --git a/tests/snapshots/integration__integration_tests__for_each__for_each_command_fails.snap b/tests/snapshots/integration__integration_tests__for_each__for_each_command_fails_in_one.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__for_each__for_each_command_fails.snap
rename to tests/snapshots/integration__integration_tests__for_each__for_each_command_fails_in_one.snap
index ed43bb700..0ca820fa6 100644
--- a/tests/snapshots/integration__integration_tests__for_each__for_each_command_fails.snap
+++ b/tests/snapshots/integration__integration_tests__for_each__for_each_command_fails_in_one.snap
@@ -27,6 +27,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
diff --git a/tests/snapshots/integration__integration_tests__for_each__for_each_no_args.snap b/tests/snapshots/integration__integration_tests__for_each__for_each_no_args_error.snap
similarity index 75%
rename from tests/snapshots/integration__integration_tests__for_each__for_each_no_args.snap
rename to tests/snapshots/integration__integration_tests__for_each__for_each_no_args_error.snap
index d45bc67a0..0239d7205 100644
--- a/tests/snapshots/integration__integration_tests__for_each__for_each_no_args.snap
+++ b/tests/snapshots/integration__integration_tests__for_each__for_each_no_args_error.snap
@@ -6,6 +6,7 @@ info:
- step
- for-each
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -13,10 +14,17 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 2
diff --git a/tests/snapshots/integration__integration_tests__for_each__for_each_with_detached.snap b/tests/snapshots/integration__integration_tests__for_each__for_each_with_detached_head.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__for_each__for_each_with_detached.snap
rename to tests/snapshots/integration__integration_tests__for_each__for_each_with_detached_head.snap
index 3358e4cf6..8f9f5e970 100644
--- a/tests/snapshots/integration__integration_tests__for_each__for_each_with_detached.snap
+++ b/tests/snapshots/integration__integration_tests__for_each__for_each_with_detached_head.snap
@@ -27,6 +27,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap b/tests/snapshots/integration__integration_tests__list__list_branch_only_with_status.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap
rename to tests/snapshots/integration__integration_tests__list__list_branch_only_with_status.snap
index b776d34a0..178c71136 100644
--- a/tests/snapshots/integration__integration_tests__list__branch_only_with_status.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_branch_only_with_status.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__detached_head.snap b/tests/snapshots/integration__integration_tests__list__list_detached_head.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__detached_head.snap
rename to tests/snapshots/integration__integration_tests__list__list_detached_head.snap
index 81dc0fc9f..62c17793a 100644
--- a/tests/snapshots/integration__integration_tests__list__detached_head.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_detached_head.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_detached_head_in_worktree.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap
rename to tests/snapshots/integration__integration_tests__list__list_detached_head_in_worktree.snap
index b9059bcd8..547963666 100644
--- a/tests/snapshots/integration__integration_tests__list__detached_head_in_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_detached_head_in_worktree.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__orphan_branch_no_error.snap b/tests/snapshots/integration__integration_tests__list__list_handles_orphan_branch.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__orphan_branch_no_error.snap
rename to tests/snapshots/integration__integration_tests__list__list_handles_orphan_branch.snap
index 5639875bd..0526950b3 100644
--- a/tests/snapshots/integration__integration_tests__list__orphan_branch_no_error.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_handles_orphan_branch.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__json_tree_matches_main_after_merge.snap b/tests/snapshots/integration__integration_tests__list__list_json_tree_matches_main_after_merge.snap
similarity index 94%
rename from tests/snapshots/integration__integration_tests__list__json_tree_matches_main_after_merge.snap
rename to tests/snapshots/integration__integration_tests__list__list_json_tree_matches_main_after_merge.snap
index 502bb691a..fd5a3800f 100644
--- a/tests/snapshots/integration__integration_tests__list__json_tree_matches_main_after_merge.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_json_tree_matches_main_after_merge.snap
@@ -19,9 +19,11 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -36,7 +38,7 @@ exit_code: 0
"sha": "33c3e5aa9f928d3eab87da8cbcd187e2ab921064",
"short_sha": "33c3e5a",
"message": "Same content on main",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -71,7 +73,7 @@ exit_code: 0
"sha": "ee45656141f6f30e6e036767adf380b3ccc639d7",
"short_sha": "ee45656",
"message": "Merge main into feature",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
diff --git a/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap b/tests/snapshots/integration__integration_tests__list__list_json_with_display_fields.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap
rename to tests/snapshots/integration__integration_tests__list__list_json_with_display_fields.snap
index d1c709898..b46dc44af 100644
--- a/tests/snapshots/integration__integration_tests__list__json_with_display_fields.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_json_with_display_fields.snap
@@ -19,9 +19,11 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -36,7 +38,7 @@ exit_code: 0
"sha": "4803e9416c19681b83017135ac3a8c1b04898868",
"short_sha": "4803e94",
"message": "Main commit 2",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -71,7 +73,7 @@ exit_code: 0
"sha": "1080181c245695ed0d64aba6b0b0b7c0bfff9530",
"short_sha": "1080181",
"message": "Feature commit 2",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -106,7 +108,7 @@ exit_code: 0
"sha": "b8b9f4453f95a585105de3ae3439d8017dee67f3",
"short_sha": "b8b9f44",
"message": "Initial commit on main",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
diff --git a/tests/snapshots/integration__integration_tests__list__json_with_git_operation.snap b/tests/snapshots/integration__integration_tests__list__list_json_with_git_operation.snap
similarity index 94%
rename from tests/snapshots/integration__integration_tests__list__json_with_git_operation.snap
rename to tests/snapshots/integration__integration_tests__list__list_json_with_git_operation.snap
index cb1745919..130cdb184 100644
--- a/tests/snapshots/integration__integration_tests__list__json_with_git_operation.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_json_with_git_operation.snap
@@ -19,9 +19,11 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -36,7 +38,7 @@ exit_code: 0
"sha": "33244e69fc0c568ce7cffd49b04c9c89ffb22510",
"short_sha": "33244e6",
"message": "Main conflicting changes",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -71,7 +73,7 @@ exit_code: 0
"sha": "33244e69fc0c568ce7cffd49b04c9c89ffb22510",
"short_sha": "33244e6",
"message": "Main conflicting changes",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
diff --git a/tests/snapshots/integration__integration_tests__list__json_with_metadata.snap b/tests/snapshots/integration__integration_tests__list__list_json_with_metadata.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__json_with_metadata.snap
rename to tests/snapshots/integration__integration_tests__list__list_json_with_metadata.snap
index f41958334..e912b7668 100644
--- a/tests/snapshots/integration__integration_tests__list__json_with_metadata.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_json_with_metadata.snap
@@ -19,9 +19,11 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -36,7 +38,7 @@ exit_code: 0
"sha": "a1e809f511b21ee516412a4520497f0cea4af366",
"short_sha": "a1e809f",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -71,7 +73,7 @@ exit_code: 0
"sha": "a1e809f511b21ee516412a4520497f0cea4af366",
"short_sha": "a1e809f",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -110,7 +112,7 @@ exit_code: 0
"sha": "a1e809f511b21ee516412a4520497f0cea4af366",
"short_sha": "a1e809f",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
diff --git a/tests/snapshots/integration__integration_tests__list__json_with_user_marker.snap b/tests/snapshots/integration__integration_tests__list__list_json_with_user_marker.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__json_with_user_marker.snap
rename to tests/snapshots/integration__integration_tests__list__list_json_with_user_marker.snap
index f4a05bff8..972716c71 100644
--- a/tests/snapshots/integration__integration_tests__list__json_with_user_marker.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_json_with_user_marker.snap
@@ -19,9 +19,11 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -36,7 +38,7 @@ exit_code: 0
"sha": "a058e792cfd4836c913fdbc0d4559af34b352b07",
"short_sha": "a058e79",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -71,7 +73,7 @@ exit_code: 0
"sha": "a058e792cfd4836c913fdbc0d4559af34b352b07",
"short_sha": "a058e79",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
@@ -110,7 +112,7 @@ exit_code: 0
"sha": "a058e792cfd4836c913fdbc0d4559af34b352b07",
"short_sha": "a058e79",
"message": "Initial commit",
- "timestamp": 0
+ "timestamp": 1735689600
},
"working_tree": {
"staged": false,
diff --git a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap b/tests/snapshots/integration__integration_tests__list__list_large_diffs_alignment.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap
rename to tests/snapshots/integration__integration_tests__list__list_large_diffs_alignment.snap
index 693de6210..e18cf388a 100644
--- a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_large_diffs_alignment.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap b/tests/snapshots/integration__integration_tests__list__list_locked_no_reason.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__locked_no_reason.snap
rename to tests/snapshots/integration__integration_tests__list__list_locked_no_reason.snap
index 88ddbb5fb..acbb4f2be 100644
--- a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_locked_no_reason.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_locked_worktree.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__locked_worktree.snap
rename to tests/snapshots/integration__integration_tests__list__list_locked_worktree.snap
index cdb27fa68..1fa446d27 100644
--- a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_locked_worktree.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap b/tests/snapshots/integration__integration_tests__list__list_long_commit_message.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__long_commit_message.snap
rename to tests/snapshots/integration__integration_tests__list__list_long_commit_message.snap
index 419187cf9..de689ed9c 100644
--- a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_long_commit_message.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap b/tests/snapshots/integration__integration_tests__list__list_many_worktrees_with_varied_stats.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap
rename to tests/snapshots/integration__integration_tests__list__list_many_worktrees_with_varied_stats.snap
index 06ac1a66f..9462f4355 100644
--- a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_many_worktrees_with_varied_stats.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap b/tests/snapshots/integration__integration_tests__list__list_maximum_working_tree_symbols.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap
rename to tests/snapshots/integration__integration_tests__list__list_maximum_working_tree_symbols.snap
index 38e4c79bb..d854cb7a7 100644
--- a/tests/snapshots/integration__integration_tests__list__maximum_working_tree_symbols.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_maximum_working_tree_symbols.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__list_multiple_worktrees.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap
rename to tests/snapshots/integration__integration_tests__list__list_multiple_worktrees.snap
index 40b75d8a0..a41f60c67 100644
--- a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_multiple_worktrees.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap b/tests/snapshots/integration__integration_tests__list__list_no_progressive_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap
rename to tests/snapshots/integration__integration_tests__list__list_no_progressive_flag.snap
index 0ac29630f..befe0bb56 100644
--- a/tests/snapshots/integration__integration_tests__list__no_progressive_flag.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_no_progressive_flag.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap b/tests/snapshots/integration__integration_tests__list__list_previous_worktree_gutter.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap
rename to tests/snapshots/integration__integration_tests__list__list_previous_worktree_gutter.snap
index 5ee218872..a5a8bb1d5 100644
--- a/tests/snapshots/integration__integration_tests__list__previous_worktree_gutter.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_previous_worktree_gutter.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__progressive_flag.snap b/tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__progressive_flag.snap
rename to tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap
index e18ec5b64..30dcd2beb 100644
--- a/tests/snapshots/integration__integration_tests__list__progressive_flag.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap b/tests/snapshots/integration__integration_tests__list__list_progressive_with_branches.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap
rename to tests/snapshots/integration__integration_tests__list__list_progressive_with_branches.snap
index ef1cfda46..77ef13641 100644
--- a/tests/snapshots/integration__integration_tests__list__progressive_with_branches.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_progressive_with_branches.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__git_error_warning.snap b/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__git_error_warning.snap
rename to tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap
index 9e01f5930..ccec5f6a0 100644
--- a/tests/snapshots/integration__integration_tests__list__git_error_warning.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_shows_warning_on_git_error.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__single_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_single_worktree.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__single_worktree.snap
rename to tests/snapshots/integration__integration_tests__list__list_single_worktree.snap
index 9361b8608..c067be4ed 100644
--- a/tests/snapshots/integration__integration_tests__list__single_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_single_worktree.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap b/tests/snapshots/integration__integration_tests__list__list_status_column_padding_with_emoji.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap
rename to tests/snapshots/integration__integration_tests__list__list_status_column_padding_with_emoji.snap
index 8026cc59c..0c8c34dc4 100644
--- a/tests/snapshots/integration__integration_tests__list__status_column_padding_emoji.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_status_column_padding_with_emoji.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_detached_head.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_detached_head.snap
index 8ab3c797c..bfd8f901d 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_detached_head.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_detached_head.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_full_with_diffs.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_full_with_diffs.snap
index 3b662927b..b7ffa555f 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_full_with_diffs.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_many_worktrees.snap
similarity index 98%
rename from tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_many_worktrees.snap
index 17055678c..ba3a52eb4 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_many_worktrees.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_many_worktrees.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap
index 34b58e6eb..da3df8147 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_multiple_worktrees.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap
index 3529fd402..f55a067d1 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_single_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_with_locked_worktree.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_with_locked_worktree.snap
index 34938ba23..60b334ac9 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_with_locked.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_with_locked_worktree.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_with_upstream.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap
rename to tests/snapshots/integration__integration_tests__list__list_task_dag_with_upstream.snap
index f71356827..659ed3621 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_with_upstream.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_task_dag_with_upstream.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap b/tests/snapshots/integration__integration_tests__list__list_unicode_commit_message.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap
rename to tests/snapshots/integration__integration_tests__list__list_unicode_commit_message.snap
index 6533e7bbd..0ce4972f2 100644
--- a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_unicode_commit_message.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap b/tests/snapshots/integration__integration_tests__list__list_user_marker_with_special_characters.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap
rename to tests/snapshots/integration__integration_tests__list__list_user_marker_with_special_characters.snap
index bc147d404..31c2184d5 100644
--- a/tests/snapshots/integration__integration_tests__list__user_marker_special_chars.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_user_marker_with_special_characters.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_warns_when_default_branch_missing_worktree.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap
rename to tests/snapshots/integration__integration_tests__list__list_warns_when_default_branch_missing_worktree.snap
index d5839875a..07d3a9505 100644
--- a/tests/snapshots/integration__integration_tests__list__default_branch_missing_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_warns_when_default_branch_missing_worktree.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__with_branches_flag.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_branches_flag.snap
index f7cd37dd2..1d9623e63 100644
--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag_no_available.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_branches_flag_no_available.snap
index cc9516c48..6cfc2d3b7 100644
--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag_no_available.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag_only_branches.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_branches_flag_only_branches.snap
index bcd65ab8c..db07d6d2d 100644
--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_branches_flag_only_branches.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap b/tests/snapshots/integration__integration_tests__list__list_with_remotes_and_branches.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_remotes_and_branches.snap
index 1903afbcd..3609c5457 100644
--- a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_remotes_and_branches.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_branches.snap b/tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_branches.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_branches.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_branches.snap
index 6a5d51d24..ac4a7145f 100644
--- a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_branches.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_branches.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_worktrees.snap b/tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_worktrees.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_worktrees.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_worktrees.snap
index b11da5e4b..50beb265e 100644
--- a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_tracked_worktrees.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_remotes_filters_tracked_worktrees.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap b/tests/snapshots/integration__integration_tests__list__list_with_remotes_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_remotes_flag.snap
index a952e1121..650e23f0c 100644
--- a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_remotes_flag.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap b/tests/snapshots/integration__integration_tests__list__list_with_user_marker.snap
similarity index 97%
rename from tests/snapshots/integration__integration_tests__list__with_user_marker.snap
rename to tests/snapshots/integration__integration_tests__list__list_with_user_marker.snap
index 1c15162c0..f6a88e2ed 100644
--- a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_with_user_marker.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_with_header.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap
rename to tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_with_header.snap
index 96ae21c57..e780f1f9a 100644
--- a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_check.snap
+++ b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_alignment_with_header.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes_in_target.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes_in_target.snap
index dcb4a77e8..e9bcc5cd6 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes_in_target.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_with_no_commit.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_with_no_commit.snap
index b6087f0d6..ebd64c3d5 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_with_no_commit.snap
@@ -25,6 +25,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
new file mode 100644
index 000000000..66b10b54c
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
@@ -0,0 +1,42 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - merge
+ - main
+ - "--no-commit"
+ - "--no-squash"
+ - "--no-remove"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
+  * fc12499 Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
+✓ Merged to main (1 commit, 1 file, +1)
+○ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
new file mode 100644
index 000000000..f40540023
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
@@ -0,0 +1,41 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - merge
+ - main
+ - "--no-commit"
+ - "--no-remove"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
+  * fc12499 Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
+✓ Merged to main (1 commit, 1 file, +1)
+○ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_dirty_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_dirty_tree.snap
new file mode 100644
index 000000000..25f6b5e18
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_dirty_tree.snap
@@ -0,0 +1,36 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - merge
+ - main
+ - "--no-commit"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Cannot merge with --no-commit: feature has uncommitted changes
+↳ Commit or stash changes first
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_already_rebased.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__merge__merge_no_rebase_already_rebased.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_not_rebased.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_not_rebased.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__merge__merge_no_rebase_not_rebased.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_not_rebased.snap
index 5ed109cad..f38dc6881 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_not_rebased.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_not_rebased.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
index e54cb51cf..9121c0da0 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_when_default_branch_missing_worktree.snap
similarity index 94%
rename from tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_when_default_branch_missing_worktree.snap
index fd1a08cc2..35d776d38 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_when_default_branch_missing_worktree.snap
@@ -22,6 +22,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
rename to tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
index e54cb51cf..9121c0da0 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
similarity index 92%
rename from tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged.snap
rename to tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
index 71ce044fd..8d0f13d8f 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
@@ -15,13 +15,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap
rename to tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
index cca81e126..06434ddcf 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
@@ -27,6 +27,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap
rename to tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
index 87e44002b..0544495c8 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
@@ -26,6 +26,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "feat: add file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
similarity index 95%
rename from tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap
rename to tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
index 44b1b5865..fd605d454 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
@@ -26,6 +26,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update tracked file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap
rename to tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
index b053ca82e..d9b27213c 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
@@ -27,6 +27,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap
rename to tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
index 04b0794a3..022aa4d60 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
@@ -26,6 +26,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
similarity index 96%
rename from tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap
rename to tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
index a5d276333..b84343df9 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
@@ -26,6 +26,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
index 5e6757a1a..1dc2aab9c 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
@@ -23,6 +23,7 @@ info:
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
WORKTRUNK_DIRECTIVE_FILE: "[DIRECTIVE_FILE]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_abort_escape.snap b/tests/snapshots/integration__integration_tests__select__select_abort_escape.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_abort_escape.snap
rename to tests/snapshots/integration__integration_tests__select__select_abort_escape.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__select__select_multiple_worktrees.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_multiple_worktrees.snap
rename to tests/snapshots/integration__integration_tests__select__select_multiple_worktrees.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_log.snap b/tests/snapshots/integration__integration_tests__select__select_preview_log.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_log.snap
rename to tests/snapshots/integration__integration_tests__select__select_preview_log.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_main_diff.snap b/tests/snapshots/integration__integration_tests__select__select_preview_main_diff.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_main_diff.snap
rename to tests/snapshots/integration__integration_tests__select__select_preview_main_diff.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_uncommitted.snap b/tests/snapshots/integration__integration_tests__select__select_preview_uncommitted.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_preview_uncommitted.snap
rename to tests/snapshots/integration__integration_tests__select__select_preview_uncommitted.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__select__select_with_branches.snap b/tests/snapshots/integration__integration_tests__select__select_with_branches.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__select__select_with_branches.snap
rename to tests/snapshots/integration__integration_tests__select__select_with_branches.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
similarity index 87%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
index 62978819b..fda474a12 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
@@ -4,7 +4,7 @@ expression: output.normalized()
---
✓ Created new worktree for fish-multiline from main @ [TMPDIR]/repo.fish-multiline
◎ Executing (--execute):
-  echo 'line 1'; echo 'line 2'; echo 'line 3'
+  echo 'line 1'; echo 'line 2'; echo 'line 3'
line 1
line 2
line 3
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
similarity index 92%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
index d29277f74..56086fdce 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
@@ -4,4 +4,4 @@ expression: output.normalized()
---
✓ Created new worktree for fish-bg from main @ [TMPDIR]/repo.fish-bg
◎ Running post-start project hook:
-  echo 'fish background task'
+  echo 'fish background task'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
similarity index 97%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
index e6cbe1dd5..1c7773745 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
@@ -3,7 +3,7 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:check1:
-  [TMPDIR]/repo/mixed-output.sh check1 3
+  [TMPDIR]/repo/mixed-output.sh check1 3
[check1] stdout line 1
[check1] stderr line 1
[check1] stdout line 2
@@ -13,7 +13,7 @@ expression: output.normalized()
[check1] stdout complete
[check1] stderr complete
◎ Running pre-merge project:check2:
-  [TMPDIR]/repo/mixed-output.sh check2 3
+  [TMPDIR]/repo/mixed-output.sh check2 3
[check2] stdout line 1
[check2] stderr line 1
[check2] stdout line 2
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
similarity index 97%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
index e6cbe1dd5..1c7773745 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
@@ -3,7 +3,7 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:check1:
-  [TMPDIR]/repo/mixed-output.sh check1 3
+  [TMPDIR]/repo/mixed-output.sh check1 3
[check1] stdout line 1
[check1] stderr line 1
[check1] stdout line 2
@@ -13,7 +13,7 @@ expression: output.normalized()
[check1] stdout complete
[check1] stderr complete
◎ Running pre-merge project:check2:
-  [TMPDIR]/repo/mixed-output.sh check2 3
+  [TMPDIR]/repo/mixed-output.sh check2 3
[check2] stdout line 1
[check2] stderr line 1
[check2] stdout line 2
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
similarity index 90%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
index 1407a084a..49ca951f0 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
@@ -3,10 +3,10 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:format:
-  echo '✓ Code formatting check passed'
+  echo '✓ Code formatting check passed'
✓ Code formatting check passed
◎ Running pre-merge project:test:
-  echo '✗ Test suite failed: 3 tests failing' && exit 1
+  echo '✗ Test suite failed: 3 tests failing' && exit 1
✗ Test suite failed: 3 tests failing
✗ pre-merge command failed: test: exit status: 1
↳ To skip pre-merge hooks, re-run with --no-verify
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
similarity index 90%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
index 1407a084a..49ca951f0 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
@@ -3,10 +3,10 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:format:
-  echo '✓ Code formatting check passed'
+  echo '✓ Code formatting check passed'
✓ Code formatting check passed
◎ Running pre-merge project:test:
-  echo '✗ Test suite failed: 3 tests failing' && exit 1
+  echo '✗ Test suite failed: 3 tests failing' && exit 1
✗ Test suite failed: 3 tests failing
✗ pre-merge command failed: test: exit status: 1
↳ To skip pre-merge hooks, re-run with --no-verify
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
similarity index 90%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
index f511c8f3a..501943ef4 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
@@ -3,13 +3,13 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:format:
-  echo '✓ Code formatting check passed'
+  echo '✓ Code formatting check passed'
✓ Code formatting check passed
◎ Running pre-merge project:lint:
-  echo '✓ Linting passed - no warnings'
+  echo '✓ Linting passed - no warnings'
✓ Linting passed - no warnings
◎ Running pre-merge project:test:
-  echo '✓ All 47 tests passed in 2.3s'
+  echo '✓ All 47 tests passed in 2.3s'
✓ All 47 tests passed in 2.3s
◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
  * [HASH] Add feature file
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
similarity index 90%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
index f511c8f3a..501943ef4 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
@@ -3,13 +3,13 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running pre-merge project:format:
-  echo '✓ Code formatting check passed'
+  echo '✓ Code formatting check passed'
✓ Code formatting check passed
◎ Running pre-merge project:lint:
-  echo '✓ Linting passed - no warnings'
+  echo '✓ Linting passed - no warnings'
✓ Linting passed - no warnings
◎ Running pre-merge project:test:
-  echo '✓ All 47 tests passed in 2.3s'
+  echo '✓ All 47 tests passed in 2.3s'
✓ All 47 tests passed in 2.3s
◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
  * [HASH] Add feature file
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
similarity index 80%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
index b3f09c7db..cdd732444 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
@@ -3,10 +3,10 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running post-create project:install:
-  uv sync
+  uv sync
Resolved 24 packages in 145ms
Installed 24 packages in 1.2s
✓ Created new worktree for feature-x from main @ [TMPDIR]/repo.feature-x
◎ Running post-start project:dev:
-  uv run dev
+  uv run dev
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
similarity index 93%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
index 89cd9fd10..dea291036 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
@@ -10,7 +10,7 @@ expression: output.normalized()
  Includes comprehensive test coverage and input validation.
✓ Squashed @ [HASH]
◎ Running pre-merge project:test:
-  uv run pytest
+  uv run pytest
============================= test session starts ==============================
collected 3 items
@@ -22,7 +22,7 @@ tests/test_auth.py::test_token_validation PASSED [100%]
============================== 3 passed in 0.8s ===============================
◎ Running pre-merge project:lint:
-  uv run ruff check
+  uv run ruff check
All checks passed!
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_remove.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_remove.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_remove.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_remove.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_switch_back.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__remove.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__remove.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__remove.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__remove.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap
similarity index 97%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap
index 3ad188b47..24883e47e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__source_flag_error_passthrough.snap
@@ -6,6 +6,6 @@ expression: output.normalized()
tip: a similar subcommand exists: 'hook'
-Usage: wt [OPTIONS] [COMMAND]
+Usage: wt [OPTIONS] [COMMAND]
For more information, try '--help'.
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__step_for_each.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__step_for_each.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__step_for_each.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__step_for_each.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
similarity index 100%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
similarity index 82%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
index 90f1ba757..74816bb9b 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
@@ -4,5 +4,5 @@ expression: output.normalized()
---
✓ Created new worktree for test-exec from main @ [TMPDIR]/repo.test-exec
◎ Executing (--execute):
-  echo executed
+  echo executed
executed
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
similarity index 82%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
index 90f1ba757..74816bb9b 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
@@ -4,5 +4,5 @@ expression: output.normalized()
---
✓ Created new worktree for test-exec from main @ [TMPDIR]/repo.test-exec
◎ Executing (--execute):
-  echo executed
+  echo executed
executed
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
similarity index 86%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
index a97c70959..31c36db12 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
@@ -3,13 +3,13 @@ source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
◎ Running post-create project:install:
-  echo 'Installing dependencies...'
+  echo 'Installing dependencies...'
Installing dependencies...
◎ Running post-create project:build:
-  echo 'Building project...'
+  echo 'Building project...'
Building project...
✓ Created new worktree for feature-hooks from main @ [TMPDIR]/repo.feature-hooks
◎ Running post-start project:server:
-  echo 'Starting dev server on port 3000'
+  echo 'Starting dev server on port 3000'
◎ Running post-start project:watch:
-  echo 'Watching for file changes'
+  echo 'Watching for file changes'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
similarity index 92%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
index fb7715456..2717d7dde 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
@@ -4,4 +4,4 @@ expression: output.normalized()
---
✓ Created new worktree for feature-with-hooks from main @ [TMPDIR]/repo.feature-with-hooks
◎ Running post-start project hook:
-  echo 'test command executed'
+  echo 'test command executed'
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
similarity index 94%
rename from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
rename to tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
index d1306760a..9047a267e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
@@ -4,4 +4,4 @@ expression: output.normalized()
---
✓ Created new worktree for feature-bg from main @ [TMPDIR]/repo.feature-bg
◎ Running post-start project hook:
-  echo 'background task'
+  echo 'background task'