Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Rename test environment variables to use WORKTRUNK_ prefix
Maximilian Roos50ffe9256ae1
diff --git a/src/commands/config.rs b/src/commands/config.rsindex cb130765b..da25db60e 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -405,12 +405,12 @@ fn check_zsh_compinit_missing() -> bool {use std::process::{Command, Stdio};// Allow tests to bypass this check since zsh subprocess behavior varies across CI envs- if std::env::var("WT_ASSUME_COMPINIT").is_ok() {+ if std::env::var("WORKTRUNK_TEST_COMPINIT_CONFIGURED").is_ok() {return false; // Assume compinit is configured}// Force compinit to be missing (for tests that expect the warning)- if std::env::var("WT_ASSUME_NO_COMPINIT").is_ok() {+ if std::env::var("WORKTRUNK_TEST_COMPINIT_MISSING").is_ok() {return true; // Force warning to appear}diff --git a/src/shell.rs b/src/shell.rsindex d2ae085bb..1be37e91a 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -285,12 +285,12 @@ pub fn detect_zsh_compinit() -> Option<bool> {use std::time::{Duration, Instant};// Allow tests to bypass this check since zsh subprocess behavior varies across CI envs- if std::env::var("WT_ASSUME_COMPINIT").is_ok() {+ if std::env::var("WORKTRUNK_TEST_COMPINIT_CONFIGURED").is_ok() {return Some(true); // Assume compinit is configured}// Force compinit to be missing (for tests that expect the warning)- if std::env::var("WT_ASSUME_NO_COMPINIT").is_ok() {+ if std::env::var("WORKTRUNK_TEST_COMPINIT_MISSING").is_ok() {return Some(false); // Force warning to appear}diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex 666781a8a..86c117b94 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -87,15 +87,14 @@ pub fn configure_completion_invocation(cmd: &mut Command, words: &[&str]) {/// (e.g., to execute shell pipelines).pub fn configure_cli_command(cmd: &mut Command) {for (key, _) in std::env::vars() {- if key.starts_with("GIT_") {+ if key.starts_with("GIT_") || key.starts_with("WORKTRUNK_") {cmd.env_remove(&key);}}- // Set to non-existent path to prevent loading user's real config- // Tests that need config should use TestRepo::clean_cli_env() which overrides this- // Note: We explicitly set this rather than removing all WORKTRUNK_* vars,- // because env_remove causes insta-cmd to capture empty values in snapshots.- // WORKTRUNK_BIN doesn't need removal - tests invoke the binary directly.+ // Set to non-existent path to prevent loading user's real config.+ // Tests that need config should use TestRepo::clean_cli_env() which overrides this.+ // Note: env_remove above may cause insta-cmd to capture empty values in snapshots,+ // but correctness (isolating from host WORKTRUNK_* vars) trumps snapshot aesthetics.cmd.env("WORKTRUNK_CONFIG_PATH", "/nonexistent/test/config.toml");cmd.env("CLICOLOR_FORCE", "1");// Jan 2, 2025 - 1 day after default commit date (2025-01-01)diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rsindex a2fab59f9..b686cf831 100644--- a/tests/integration_tests/config_show.rs+++ b/tests/integration_tests/config_show.rs@@ -177,7 +177,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)let mut cmd = wt_command();repo.clean_cli_env(&mut cmd);// Force compinit warning for deterministic tests across environments- cmd.env("WT_ASSUME_NO_COMPINIT", "1");+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");cmd.arg("config").arg("show").current_dir(repo.root_path());set_temp_home_env(&mut cmd, temp_home.path());@@ -220,7 +220,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)repo.clean_cli_env(&mut cmd);cmd.arg("config").arg("show").current_dir(repo.root_path());set_temp_home_env(&mut cmd, temp_home.path());- cmd.env("WT_ASSUME_COMPINIT", "1"); // Bypass zsh subprocess check+ cmd.env("WORKTRUNK_TEST_COMPINIT_CONFIGURED", "1"); // Bypass zsh subprocess checkassert_cmd_snapshot!(cmd);});@@ -255,7 +255,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)repo.clean_cli_env(&mut cmd);cmd.arg("config").arg("show").current_dir(repo.root_path());set_temp_home_env(&mut cmd, temp_home.path());- cmd.env("WT_ASSUME_COMPINIT", "1"); // Bypass zsh subprocess check (unreliable on CI)+ cmd.env("WORKTRUNK_TEST_COMPINIT_CONFIGURED", "1"); // Bypass zsh subprocess check (unreliable on CI)assert_cmd_snapshot!(cmd);});diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex 7f60708f2..1a80436c0 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -20,7 +20,7 @@ fn test_configure_shell_with_yes() {set_temp_home_env(&mut cmd, temp_home.path());cmd.env("SHELL", "/bin/zsh");// Force compinit warning for deterministic tests across environments- cmd.env("WT_ASSUME_NO_COMPINIT", "1");+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");cmd.arg("config").arg("shell").arg("install")@@ -66,7 +66,7 @@ fn test_configure_shell_specific_shell() {set_temp_home_env(&mut cmd, temp_home.path());cmd.env("SHELL", "/bin/zsh");// Force compinit warning for deterministic tests across environments- cmd.env("WT_ASSUME_NO_COMPINIT", "1");+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");cmd.arg("config").arg("shell").arg("install")@@ -292,7 +292,7 @@ fn test_configure_shell_multiple_configs() {set_temp_home_env(&mut cmd, temp_home.path());cmd.env("SHELL", "/bin/zsh");// Force compinit warning for deterministic tests across environments- cmd.env("WT_ASSUME_NO_COMPINIT", "1");+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");cmd.arg("config").arg("shell").arg("install")@@ -355,7 +355,7 @@ fn test_configure_shell_mixed_states() {set_temp_home_env(&mut cmd, temp_home.path());cmd.env("SHELL", "/bin/zsh");// Force compinit warning for deterministic tests across environments- cmd.env("WT_ASSUME_NO_COMPINIT", "1");+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");cmd.arg("config").arg("shell").arg("install")@@ -680,7 +680,7 @@ fn test_configure_shell_no_warning_when_compinit_enabled() {set_temp_home_env(&mut cmd, temp_home.path());cmd.env("SHELL", "/bin/zsh");cmd.env("ZDOTDIR", temp_home.path()); // Point zsh to our test home for config- cmd.env("WT_ASSUME_COMPINIT", "1"); // Bypass zsh subprocess check (unreliable on CI)+ cmd.env("WORKTRUNK_TEST_COMPINIT_CONFIGURED", "1"); // Bypass zsh subprocess check (unreliable on CI)cmd.arg("config").arg("shell").arg("install")diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snapindex 59affdbb1..5f8ff1d73 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap@@ -18,7 +18,7 @@ info:LC_ALL: CSOURCE_DATE_EPOCH: "1735776000"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"- WT_ASSUME_COMPINIT: "1"+ WORKTRUNK_TEST_COMPINIT_CONFIGURED: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: truediff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snapindex 72ac18d40..aa106f622 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap@@ -18,7 +18,7 @@ info:LC_ALL: CSOURCE_DATE_EPOCH: "1735776000"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"- WT_ASSUME_COMPINIT: "1"+ WORKTRUNK_TEST_COMPINIT_CONFIGURED: "1"XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: true