Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Re-enable Windows config_show tests (#149)
Maximilian Roos299b1ce75f8c
diff --git a/src/commands/list/ci_status.rs b/src/commands/list/ci_status.rsindex ad4da563f..da6172e25 100644--- a/src/commands/list/ci_status.rs+++ b/src/commands/list/ci_status.rs@@ -418,6 +418,7 @@ fn tool_available(tool: &str, args: &[&str]) -> bool {cmd_str.push(' ');cmd_str.push_str(arg);}+Command::new("cmd").args(["/c", &cmd_str]).output()diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex 5bd244029..5aaf55103 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -1277,14 +1277,24 @@ esac#[cfg(windows)]{let gh_cmd = mock_bin.join("gh.cmd");+ // Use goto-based structure for reliable exit codes on Windows.+ // Single-line `if ... exit /b N` can have inconsistent behavior+ // when scripts are invoked via `cmd /c`.std::fs::write(&gh_cmd,r#"@echo off-if "%1"=="--version" (- echo gh version 2.0.0 (mock)- exit /b 0-)-if "%1"=="auth" exit /b 1+if "%1"=="--version" goto version+if "%1"=="auth" goto auth+goto fail++:version+echo gh version 2.0.0 (mock)+exit /b 0++:auth+exit /b 1++:failexit /b 1"#,)@@ -1325,14 +1335,22 @@ esac#[cfg(windows)]{let glab_cmd = mock_bin.join("glab.cmd");+ // Use goto-based structure for reliable exit codes on Windows.std::fs::write(&glab_cmd,r#"@echo off-if "%1"=="--version" (- echo glab version 1.0.0 (mock)- exit /b 0-)-if "%1"=="auth" exit /b 1+if "%1"=="--version" goto version+if "%1"=="auth" goto auth+goto fail++:version+echo glab version 1.0.0 (mock)+exit /b 0++:auth+exit /b 1++:failexit /b 1"#,)@@ -1368,7 +1386,7 @@ exit /b 1}paths.insert(0, mock_bin.clone());- let new_path = std::env::join_paths(paths).unwrap();+ let new_path = std::env::join_paths(&paths).unwrap();cmd.env("PATH", new_path);}}diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rsindex a82f5b6f7..6f47e2d69 100644--- a/tests/integration_tests/config_show.rs+++ b/tests/integration_tests/config_show.rs@@ -6,13 +6,8 @@ use rstest::rstest;use std::fs;use tempfile::TempDir;-// TODO: Windows CI fails to find mock gh/glab batch files because Rust's Command::new-// doesn't search PATHEXT for .cmd files. Issue: rust-lang/rust#37380-// Fix needed: either use cmd.exe /c wrapper or create actual .exe shims.-/// Test `wt config show` with both global and project configs present#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_with_project_config(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -57,7 +52,6 @@ server = "npm run dev"/// Test `wt config show` when there is no project config#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_no_project_config(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -86,7 +80,6 @@ fn test_config_show_no_project_config(mut repo: TestRepo, temp_home: TempDir) {/// Test `wt config show` outside a git repository#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_outside_git_repo(mut repo: TestRepo, temp_home: TempDir) {let temp_dir = tempfile::tempdir().unwrap();@@ -116,7 +109,6 @@ fn test_config_show_outside_git_repo(mut repo: TestRepo, temp_home: TempDir) {/// Test `wt config show` warns when zsh compinit is not enabled#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_zsh_compinit_warning(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -151,7 +143,6 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)/// Test `wt config show` shows hint when some shells configured, some not#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_partial_shell_config_shows_hint(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -194,7 +185,6 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)/// Test `wt config show` shows no warning when zsh compinit is enabled#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_zsh_compinit_correct_order(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -231,7 +221,6 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)/// Test `wt config show` warns about unknown/misspelled keys in project config#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_warns_unknown_project_keys(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -268,7 +257,6 @@ fn test_config_show_warns_unknown_project_keys(mut repo: TestRepo, temp_home: Te/// Test `wt config show` warns about unknown keys in user config#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_warns_unknown_user_keys(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -296,7 +284,6 @@ fn test_config_show_warns_unknown_user_keys(mut repo: TestRepo, temp_home: TempD/// Test `wt config show --full` when commit generation is not configured#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_full_not_configured(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();@@ -330,7 +317,6 @@ fn test_config_show_full_not_configured(mut repo: TestRepo, temp_home: TempDir)/// Test `wt config show --full` when commit generation command doesn't exist#[rstest]-#[cfg_attr(windows, ignore = "mock gh/glab batch files not found on Windows")]fn test_config_show_full_command_not_found(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic BINARIES outputrepo.setup_mock_ci_tools_unauthenticated();