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

Improve the way FAIL and PASS is presented in the terminal #1682

Open
odeta939 opened this issue Nov 21, 2024 · 1 comment
Open

Improve the way FAIL and PASS is presented in the terminal #1682

odeta939 opened this issue Nov 21, 2024 · 1 comment

Comments

@odeta939
Copy link

Description

I find the console output of this library very hard to read, sometimes it is hard to see where is the actual problem cause it is buried in a long list of bytes.

  1. Make this output optional with a flag :

Error: Not equal: expected: []byte{0x7b, 0x22, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x4e, 0x4f......} actual : []byte{0x7b, 0x22, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x4e, 0x4f, 0x54........}

Disclaimer: It might be a skill issue from my part and it might be that I just don't appreciate a good thing ( so please explain to me if I am wrong and missing something here)

  1. Improve the way PASS and FAIL is displayed with a colour schema or Emojies like ❌ and ✅

Proposed solution

Right now I use this command to make my output a bit more pleasant to look at :

  1. to get the emojies next to PASS and FAIL instead of -----

go test -v ./... | sed ''/---\ PASS:/s//"$(printf "\033[32m✅--- PASS:\033[0m")"/'' | sed ''/---\ FAIL:/s//"$(printf "\033[31m❌--- FAIL:\033[0m")"/''

  1. the package diffmatchpatch which colours the missmatch of the output. So I see the mistake coloured in red and the expectation in green.

maybe these features could be somehow incorporated in this library or add with a flag for optional

Use case

Workarounds mentioned above.

Usecase: people like me(borderline dyslexic) who often miss-types words and has difficulties finding the important information in a soup of white text on a black background, would benefit from this greatly.
Not only it would improve usability of your library but also bring some life and fun to testing (who doesn't like to see all tests go green in their terminal?)

@brackendawson
Copy link
Collaborator

Go itself reports on failed Vs passed tests and it does not use colour or emoji. I don't think testify should do so either. Asides from all the terminal compatibility concerns you have to get right a test could fail by calling t.FailNow() and it would not get a red emoji in the sea of green ones.

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

No branches or pull requests

2 participants