Skip to content

feat(console): unified diff for multiline assert_equals/assert_same failures#790

Merged
Chemaclass merged 3 commits into
mainfrom
feat/777-console-unified-diff
Jul 14, 2026
Merged

feat(console): unified diff for multiline assert_equals/assert_same failures#790
Chemaclass merged 3 commits into
mainfrom
feat/777-console-unified-diff

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #777

For multiline strings (command output, file contents), assert_equals/assert_same failures print two quoted blobs and you hunt for the difference by eye. Snapshot failures already render a git diff — this reuses that machinery for assert failures.

💡 Changes

  • Multiline assert_equals/assert_same failures now render a git word-diff below the header, truncating the inline values to their first line while the diff is shown
  • Extracts the snapshot-diff block into a shared render_diff helper, now color-aware (honors --no-color instead of always colorizing)
  • Single-line failures and machine reports (JUnit/TAP/JSON) stay byte-identical; git required with a graceful plain fallback; opt out via BASHUNIT_NO_DIFF=true

assert_equals/assert_same failures with multiline expected or actual
values now render a git word-diff below the Expected/but got header
(inline values truncated to their first line + ellipsis while the diff
is shown), making command-output/file-content differences readable.

Extracts the snapshot-failure diff block into a shared
bashunit::console_results::render_diff helper (now color-aware: honors
--no-color instead of always colorizing). Single-line failures and machine
reports (JUnit/TAP/JSON) are byte-identical. Requires git (graceful plain
fallback); opt out with BASHUNIT_NO_DIFF=true.

Closes #777
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 13, 2026
@Chemaclass Chemaclass self-assigned this Jul 13, 2026
CI copies .env.example to .env, whose empty BASHUNIT_NO_DIFF= line was
sourced with allexport and clobbered the inherited BASHUNIT_NO_DIFF=true,
re-enabling the diff. Pass --skip-env-file (as the other spawned-bashunit
acceptance tests do) so the test env is deterministic.
@Chemaclass Chemaclass merged commit 716f886 into main Jul 14, 2026
48 of 50 checks passed
@Chemaclass Chemaclass deleted the feat/777-console-unified-diff branch July 14, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant