Skip to content

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

ci: run the full test suite across the feature powerset, not just lib (#3068)

Maximilian Roos465b8fd0229f
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index aca4b0fc7..47ac99f19 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -1,7 +1,7 @@
name: nightly
# Slower checks that aren't worth running on every PR but should run before a
# release. Jobs:
-# - feature-powerset: feature-flag unification, check + lib tests (motivated by #2442)
+# - feature-powerset: feature-flag unification, check + test suite (motivated by #2442)
# - release-target: PTY+shell suite on the release triples ci.yaml doesn't cover
# - benchmarks: full criterion suite + time-series gist append (cron only)
# - check-unused-dependencies: cargo-udeps on nightly toolchain
@@ -90,14 +90,16 @@ jobs:
# worktrunk, or feature unification will mask gating bugs by silently
# enabling `cli` in the lib build (see tests/helpers/wt-perf/Cargo.toml).
#
- # The test step runs the unit tests per combination — the check step
+ # The test step runs the test suite per combination — the check step
# strips dev-deps, so `#[cfg(test)]` code is invisible to it, and a test
# importing a feature-gated symbol without its own gate, or a snapshot
# baking feature-dependent output, only surfaces when tests are built and
- # run per combo. Bounded to `--lib`: the integration suite snapshots `wt`
- # output, which bakes in syntax-highlighted command rendering, so it only
- # passes with syntax-highlighting on; ci.yaml's `test` matrix already
- # runs it (with shell-integration-tests) on every PR.
+ # run per combo. The integration suite declares
+ # `required-features = ["cli", "syntax-highlighting"]` (Cargo.toml) because
+ # it execs the `wt` binary and snapshots its highlighted output, so cargo
+ # runs it only on combinations that satisfy both and runs lib + doc tests
+ # everywhere. No target filter, so default-members builds the mock-stub
+ # helper bin the lib suite shells out to.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
@@ -113,15 +115,23 @@ jobs:
with:
tool: cargo-hack
- - run: cargo hack check --feature-powerset --no-dev-deps
+ # The `shell-integration-tests` combinations run PTY tests that spawn real
+ # zsh/fish and probe nushell; match the test matrix's shell setup
+ # (.github/actions/test-setup) so those combinations run, not just compile.
+ - name: Install shells (zsh, fish)
+ uses: awalsh128/[email protected]
+ with:
+ packages: zsh fish
+ version: 1.0
- # The lib suite shells out to the mock-stub helper bin, which `--lib`
- # doesn't build (tests/CLAUDE.md documents the fresh-target panic).
- # mock-stub doesn't depend on worktrunk features, so one build serves
- # every combo.
- - run: cargo build -p mock-stub
+ - name: Install nushell
+ uses: hustcer/setup-nu@v3
+ with:
+ version: '0.113.1'
+
+ - run: cargo hack check --feature-powerset --no-dev-deps
- - run: cargo hack test --feature-powerset --lib
+ - run: cargo hack test --feature-powerset
release-target:
# Build and run the test suite on the release triples that ci.yaml's
diff --git a/Cargo.toml b/Cargo.toml
index cdcf31bec..32adcddd3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -71,6 +71,22 @@ required-features = ["cli"]
name = "git-wt"
path = "src/git_wt.rs"
required-features = ["cli", "git-wt"]
+# `git_wt.rs` is `include!("main.rs")`, so its unit tests are byte-identical
+# duplicates of the `wt` binary's. Running them adds no coverage and breaks
+# under `cargo hack test --feature-powerset`: insta derives snapshot filenames
+# from the crate name, so the duplicates look for `git_wt__*.snap` files that
+# don't exist (only `wt__*`). The `check` powerset still compiles this target.
+test = false
+
+# The integration suite execs the `wt` binary (needs `cli`) and snapshots its
+# rendered output, which bakes in syntax highlighting (needs
+# `syntax-highlighting`). Declaring both lets `cargo hack test
+# --feature-powerset` skip this target on combinations that can't satisfy it
+# rather than fail; lib and doc tests still run on every combination.
+[[test]]
+name = "integration"
+path = "tests/integration.rs"
+required-features = ["cli", "syntax-highlighting"]
[dependencies]
anyhow = "1.0"
diff --git a/tests/CLAUDE.md b/tests/CLAUDE.md
index 4b30e00a7..8c1243e25 100644
--- a/tests/CLAUDE.md
+++ b/tests/CLAUDE.md
@@ -10,7 +10,7 @@ cargo test --test integration # integration
cargo test --test integration --features shell-integration-tests # + shell tests
```
-A filtered `--test integration` run on a fresh `target/` panics with "mock-stub binary not found" (a target filter skips the helper-bin build). Fix: `cargo build -p mock-stub`, or use `cargo nextest run` / `cargo llvm-cov nextest`.
+A target-filtered run (`--lib`, `--test integration`, …) on a fresh `target/` panics with "mock-stub binary not found" (a target filter skips the helper-bin build). Fix: `cargo build -p mock-stub`, or use `cargo nextest run` / `cargo llvm-cov nextest`.
**Claude Code web:** `task setup-web` installs zsh/fish/nushell, `gh`, and dev tools. Install `task` first if needed: `sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/bin` then `export PATH="$HOME/bin:$PATH"`. The permission tests (`test_permission_error_prevents_save`, `test_approval_prompt_permission_error`) skip automatically when running as root.