Skip to content

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

fix(test): gate the highlighted hook-template snapshot on syntax-highlighting (#4427)

Worktrunk Botc388ec375e88
diff --git a/src/git/error.rs b/src/git/error.rs
index 1c0aa979b..8f898ed3a 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -2627,6 +2627,19 @@ mod tests {
};
assert_snapshot!(err.render(), @"✗ pre-merge user:lint failed (exit code 1)");
+ // Silent errors produce empty output
+ assert_eq!(format!("{}", WorktrunkError::CommandNotApproved), "");
+ assert_eq!(
+ format!("{}", WorktrunkError::AlreadyDisplayed { exit_code: 1 }),
+ ""
+ );
+ }
+
+ // An unnamed hook failure renders its template through `format_bash_with_gutter`,
+ // whose output is highlighted only with the feature on.
+ #[cfg(feature = "syntax-highlighting")]
+ #[test]
+ fn snapshot_unnamed_hook_failure_shows_template() {
let err = WorktrunkError::HookCommandFailed {
hook_type: HookType::PreCreate,
source: HookSource::User,
@@ -2640,13 +2653,6 @@ mod tests {
echo test
setup failed
");
-
- // Silent errors produce empty output
- assert_eq!(format!("{}", WorktrunkError::CommandNotApproved), "");
- assert_eq!(
- format!("{}", WorktrunkError::AlreadyDisplayed { exit_code: 1 }),
- ""
- );
}
#[test]