Skip to content

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

test: use standard config override to disable picker timeout in tests (#2221)

Maximilian Roos8c380aef7e8c
diff --git a/src/config/user/sections.rs b/src/config/user/sections.rs
index 14983a069..48990bbf6 100644
--- a/src/config/user/sections.rs
+++ b/src/config/user/sections.rs
@@ -351,13 +351,8 @@ impl SwitchPickerConfig {
}
/// Wall-clock budget for picker data collection (default: 500ms).
- /// Returns `None` when disabled (timeout_ms = 0 or WORKTRUNK_TEST_PICKER_NO_TIMEOUT set).
+ /// Returns `None` when disabled (timeout_ms = 0).
pub fn timeout(&self) -> Option<std::time::Duration> {
- // Env var bypass for test reliability — config file loading is unreliable
- // in PTY subprocesses on macOS CI, so tests disable the timeout directly.
- if std::env::var_os("WORKTRUNK_TEST_PICKER_NO_TIMEOUT").is_some() {
- return None;
- }
match self.timeout_ms {
Some(0) => None,
Some(ms) => Some(std::time::Duration::from_millis(ms)),
diff --git a/src/testing/mod.rs b/src/testing/mod.rs
index ec21521f2..f565a5bc2 100644
--- a/src/testing/mod.rs
+++ b/src/testing/mod.rs
@@ -888,10 +888,10 @@ impl TestRepo {
self.test_approvals_path().display().to_string(),
),
// Disable picker collect timeout to prevent flaky snapshots on slow
- // CI runners (especially macOS). Bypasses config file loading.
+ // CI runners (especially macOS).
(
- "WORKTRUNK_TEST_PICKER_NO_TIMEOUT".to_string(),
- "1".to_string(),
+ "WORKTRUNK__SWITCH__PICKER__TIMEOUT_MS".to_string(),
+ "0".to_string(),
),
]);