Skip to content

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

refactor: remove unused dev-detach helper and disable empty test suites (#540)

Maximilian Roosf89aec4b8c74
diff --git a/Cargo.lock b/Cargo.lock
index 538db8d13..d94f04b99 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -741,13 +741,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "dev-detach"
-version = "0.1.0"
-dependencies = [
- "nix 0.30.1",
-]
-
[[package]]
name = "digest"
version = "0.10.7"
diff --git a/Cargo.toml b/Cargo.toml
index a60d0cd39..26a81b90c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[workspace]
-members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach", "tests/helpers/mock-stub"]
-# Include helpers so `cargo test` builds their binaries (via their integration tests)
-default-members = [".", "tests/helpers/dev-detach", "tests/helpers/mock-stub"]
+members = ["tests/helpers/setup-select-test", "tests/helpers/mock-stub"]
+# Include mock-stub so `cargo test` builds its binary (via its integration test)
+default-members = [".", "tests/helpers/mock-stub"]
[package]
name = "worktrunk"
@@ -64,6 +64,7 @@ required-features = ["git-wt"]
[[bin]]
name = "analyze-trace"
path = "src/bin/analyze-trace.rs"
+test = false
[dependencies]
anyhow = "1.0"
diff --git a/tests/helpers/dev-detach/Cargo.toml b/tests/helpers/dev-detach/Cargo.toml
deleted file mode 100644
index 3443b5831..000000000
--- a/tests/helpers/dev-detach/Cargo.toml
+++ /dev/null
@@ -1,34 +0,0 @@
-# Helper binary for TTY isolation in shell integration tests.
-#
-# WHY A SEPARATE PACKAGE?
-# This binary is a workspace member with `publish = false` for cargo-dist compatibility.
-#
-# cargo-dist automatically discovers all [[bin]] entries in a package and expects
-# to distribute them. There's no per-binary exclusion - only package-level via
-# `publish = false` or `dist = false`. Moving test-only binaries to separate
-# packages with `publish = false` prevents them from being included in releases.
-#
-# Alternative approaches that DON'T work for cargo-dist:
-# - `required-features = ["test-feature"]` on [[bin]]: cargo-dist still tries to
-# find and package the binary, failing with "bin not found" during release
-# - `[package.metadata.dist] dist = false` in main package: excludes the entire
-# package from distribution, not individual binaries
-# - `workspace.default-members`: makes `cargo build` include this package, but
-# `cargo test` only builds test targets, not binaries (even for selected packages)
-#
-# HOW THE BINARY GETS BUILT:
-# `cargo test` only builds binaries for packages with integration tests (so tests
-# can run the binary). This package has a dummy integration test (tests/builds.rs)
-# that triggers binary compilation. Combined with `workspace.default-members`
-# including this package, `cargo test` automatically builds the binary.
-#
-# This is a workspace member (not a separate workspace) to share target/ and Cargo.lock.
-# Never published to crates.io (publish = false) - only used during testing.
-[package]
-name = "dev-detach"
-version = "0.1.0"
-edition = "2024"
-publish = false
-
-[target.'cfg(unix)'.dependencies]
-nix = { version = "0.30", default-features = false, features = ["process"] }
diff --git a/tests/helpers/dev-detach/src/main.rs b/tests/helpers/dev-detach/src/main.rs
deleted file mode 100644
index 2804e9d6f..000000000
--- a/tests/helpers/dev-detach/src/main.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-//! Test helper for TTY isolation in shell integration tests.
-//!
-//! Detaches child processes from controlling terminals by calling setsid()
-//! before exec'ing the target command. Prevents PTY-related hangs when running
-//! nextest in environments like unbuffer or script.
-//!
-//! Usage: dev-detach \<command\> [args...]
-
-use std::process;
-
-fn main() {
- #[cfg(unix)]
- {
- use nix::unistd::{execvp, setsid};
- use std::{env, ffi::CString};
-
- if let Err(e) = setsid() {
- eprintln!("dev-detach: setsid failed: {e}");
- process::exit(1);
- }
-
- let args: Vec<String> = env::args().skip(1).collect();
- if args.is_empty() {
- eprintln!("usage: dev-detach <command> [args...]");
- process::exit(2);
- }
-
- let prog = CString::new(args[0].clone()).unwrap_or_else(|_| {
- eprintln!("dev-detach: command contains null byte");
- process::exit(2);
- });
- let cargs: Vec<CString> = args
- .iter()
- .map(|a| {
- CString::new(a.as_str()).unwrap_or_else(|_| {
- eprintln!("dev-detach: argument contains null byte");
- process::exit(2);
- })
- })
- .collect();
-
- // execvp only returns on error (success replaces this process)
- let Err(e) = execvp(prog.as_c_str(), &cargs);
- eprintln!("dev-detach: execvp failed: {e}");
- process::exit(127);
- }
-
- #[cfg(not(unix))]
- {
- eprintln!("dev-detach is Unix-only (used for TTY isolation in tests)");
- process::exit(1);
- }
-}
diff --git a/tests/helpers/dev-detach/tests/builds.rs b/tests/helpers/dev-detach/tests/builds.rs
deleted file mode 100644
index ca66e5b36..000000000
--- a/tests/helpers/dev-detach/tests/builds.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[test]
-fn builds() {
- // Intentionally empty.
- // This integration test forces cargo to build the package's binary when testing.
-}
diff --git a/tests/helpers/mock-stub/Cargo.toml b/tests/helpers/mock-stub/Cargo.toml
index 472b41c24..3f3f248bc 100644
--- a/tests/helpers/mock-stub/Cargo.toml
+++ b/tests/helpers/mock-stub/Cargo.toml
@@ -5,11 +5,14 @@
# gh.exe + gh (script) -> gh.exe runs: bash gh <args>
#
# WHY A SEPARATE PACKAGE?
-# See dev-detach/Cargo.toml for explanation of cargo-dist compatibility.
+# cargo-dist automatically discovers all [[bin]] entries and expects to distribute
+# them. Moving test-only binaries to separate packages with `publish = false`
+# prevents them from being included in releases.
#
# HOW THE BINARY GETS BUILT:
# Has a dummy integration test (tests/builds.rs) that triggers binary compilation
-# when running `cargo test`. See dev-detach for details.
+# when running `cargo test`. Combined with `workspace.default-members` including
+# this package, `cargo test` automatically builds the binary.
[package]
name = "mock-stub"
version = "0.1.0"
@@ -19,3 +22,4 @@ publish = false
[[bin]]
name = "mock-stub"
path = "src/main.rs"
+test = false
diff --git a/tests/helpers/mock-stub/tests/builds.rs b/tests/helpers/mock-stub/tests/builds.rs
index 0c33c171f..5992cd9e0 100644
--- a/tests/helpers/mock-stub/tests/builds.rs
+++ b/tests/helpers/mock-stub/tests/builds.rs
@@ -1,5 +1,5 @@
//! Dummy test that triggers binary compilation.
-//! See dev-detach/Cargo.toml for why this is needed.
+//! See mock-stub/Cargo.toml for why this is needed.
#[test]
-fn dummy() {}
+fn builds() {}
diff --git a/tests/helpers/setup-select-test/Cargo.toml b/tests/helpers/setup-select-test/Cargo.toml
index 284e77d70..ba6d5e2aa 100644
--- a/tests/helpers/setup-select-test/Cargo.toml
+++ b/tests/helpers/setup-select-test/Cargo.toml
@@ -6,6 +6,12 @@ name = "setup-select-test"
version = "0.1.0"
edition = "2024"
publish = false
+autotests = false
+
+[[bin]]
+name = "setup-select-test"
+path = "src/main.rs"
+test = false
[dependencies]
dunce = "1.0"