Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print colorful diff between actual output and an expected output on test failure via smth like colordiff #60

Open
EmilyGraceSeville7cf opened this issue Mar 16, 2023 · 1 comment · May be fixed by #65

Comments

@EmilyGraceSeville7cf
Copy link

It's really hard to detect the difference between actual and expected output right from the bats message when the test fails. Because bats doesn't indicate what the difference between expectation and real result:

image

Such a message doesn't really show what should be changed to make the test pass.

This issue is transferred from this repository.

@brammeleman
Copy link

A colorful diff seems a bit difficult as all failure output is supposed to be red. Looks like adding the output of just diff already seems to be helpful. This quick hack (probably not in bats' coding style) helps me to spot the differences in the expected and actual output. Apply this patch on assert_output.bash:

189a190
>       ( \
192c193,196
<       'actual'   "$output" \
---
>       'actual'   "$output"
>       echo "Diff:"
>       diff <(echo "$expected") <(echo "$output")
>       )\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants