Repository navigation
fix(test): gate the highlighted hook-template snapshot on syntax-highlighting - #4427
Merged
Merged
Conversation
…lighting snapshot_worktrunk_error_display gained a case in #4352 that renders an unnamed hook's template through format_bash_with_gutter, whose output is highlighted only with the syntax-highlighting feature. The nightly feature-powerset job's cargo test --no-default-features run rendered it unhighlighted and failed. Move that case into its own test gated on the feature, as snapshot_worktree_creation_failed already is, so the rest of the test still runs in every feature configuration.
This was referenced Oct 11, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The nightly
feature-powersetjob (run 38115848986) fails incargo test --no-default-featuresongit::error::tests::snapshot_worktrunk_error_display. #4352 added a case to that test where an unnamed hook failure renders its template (echo test) throughformat_bash_with_gutter. That output is only highlighted when thesyntax-highlightingfeature is on, so without default features the snapshot gets plainecho testand doesn't match.This change moves that case into its own test,
snapshot_unnamed_hook_failure_shows_template, gated on#[cfg(feature = "syntax-highlighting")].snapshot_worktree_creation_failedin the same module is already gated this way for the same reason. The other assertions insnapshot_worktrunk_error_displaystill run in every feature configuration. This only changes tests.Verification:
cargo test --lib --no-default-features snapshot_worktrunk_error_displayfailed before the change and passes after it. With default features, both tests pass.cargo fmt --checkandcargo clippy --lib --tests --no-default-features -D warningsare clean.