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

[FEATURE REQUEST] Quiet mode #110

Closed
dalisoft opened this issue Mar 3, 2024 · 7 comments · Fixed by #114
Closed

[FEATURE REQUEST] Quiet mode #110

dalisoft opened this issue Mar 3, 2024 · 7 comments · Fixed by #114

Comments

@dalisoft
Copy link

dalisoft commented Mar 3, 2024

I would like to see quiet mode so i see only where test name + status, not detailed results

@pgrange
Copy link
Owner

pgrange commented Mar 4, 2024

Hello @dalisoft,

First, out of curiosity, may I ask what's your use case for that? I'm asking because it feels very odd to me to not want to see the failure of a failed test. And the fact that I'm surprised about it means that I really have no idea what the use case for that would be so I'm interested to learn here how people are using bash_unit :)

Also, would you have some examples of the output you would like to see for such a feature?

@dalisoft
Copy link
Author

dalisoft commented Mar 4, 2024

@pgrange It's really for #113 so i can see only failed tests to prevent/avoid confusing. Currently i have a little more tests for simple bash script and already achieved 80%+ coverage with combination of bashcov+bash_unit but still not achieved fully spec compatible tests passing, so opened bunch of issues/feature request.
I know it's not easy to implement new feature or fix as not always have time (i'm also was open source contributor/developer) but happy to see new features, i'm choose bash_unit over other options because it looks more easier and has cleaner documentation

@pgrange
Copy link
Owner

pgrange commented Mar 4, 2024

So let's take #113 output as an exemple. Now we have this:

Running tests in tests/cli/core.test.sh
Initialized empty Git repository in /private/var/folders/zf/71cnxqxj6nq_m0tzw2gpb03w0000gn/T/tmp.MEG0M0Opej/.git/
        Running test_core_cli_help ... SUCCESS ✓ 
        Running test_core_cli_invalid_arg ... FAILURE ✗ 
 expected status code 1 but was 127
err> ./bash_unit: line 99: [release-me]: command not found
./core.test.sh:57:test_core_cli_invalid_arg()
        Running test_core_cli_invalid_option ... FAILURE ✗ 
 expected status code 1 but was 127
err> ./bash_unit: line 99: [release-me]: command not found
./core.test.sh:53:test_core_cli_invalid_option()
        Running test_core_cli_version ... SUCCESS ✓ 
Running tests in tests/cli/no-git.test.sh
        Running test_nogit_1 ... SUCCESS ✓ 
Overall result: FAILURE ✗ 

If we add the -q option, would you like to see that?

Running tests in tests/cli/core.test.sh
Initialized empty Git repository in /private/var/folders/zf/71cnxqxj6nq_m0tzw2gpb03w0000gn/T/tmp.MEG0M0Opej/.git/
        Running test_core_cli_help ... SUCCESS ✓ 
        Running test_core_cli_invalid_arg ... FAILURE ✗ 
        Running test_core_cli_invalid_option ... FAILURE ✗ 
        Running test_core_cli_version ... SUCCESS ✓ 
Running tests in tests/cli/no-git.test.sh
        Running test_nogit_1 ... SUCCESS ✓ 
Overall result: FAILURE ✗ 

Or would you like to also see the stack trace?

Running tests in tests/cli/core.test.sh
Initialized empty Git repository in /private/var/folders/zf/71cnxqxj6nq_m0tzw2gpb03w0000gn/T/tmp.MEG0M0Opej/.git/
        Running test_core_cli_help ... SUCCESS ✓ 
        Running test_core_cli_invalid_arg ... FAILURE ✗ 
./core.test.sh:57:test_core_cli_invalid_arg()
        Running test_core_cli_invalid_option ... FAILURE ✗ 
./core.test.sh:53:test_core_cli_invalid_option()
        Running test_core_cli_version ... SUCCESS ✓ 
Running tests in tests/cli/no-git.test.sh
        Running test_nogit_1 ... SUCCESS ✓ 
Overall result: FAILURE ✗ 

@dalisoft
Copy link
Author

dalisoft commented Mar 4, 2024

So let's make it more configurable like:

  1. --quiet mode like in your -q option
  2. Default option like your last example (-q with stack trace)
  3. --verbose mode like currently by default

Example of how i doing you can look at here

@pgrange
Copy link
Owner

pgrange commented Mar 4, 2024

Thank you. I do not consider the current mode as verbose but really as a normal one so I'll keep it that way. Also, the less options, the less complexity and I'd like to keep it as simple as possible but still take your issue into account.

So if that suits your actual need, I'll go with only -q showing this:

Running tests in tests/cli/core.test.sh
Initialized empty Git repository in /private/var/folders/zf/71cnxqxj6nq_m0tzw2gpb03w0000gn/T/tmp.MEG0M0Opej/.git/
        Running test_core_cli_help ... SUCCESS ✓ 
        Running test_core_cli_invalid_arg ... FAILURE ✗ 
        Running test_core_cli_invalid_option ... FAILURE ✗ 
        Running test_core_cli_version ... SUCCESS ✓ 
Running tests in tests/cli/no-git.test.sh
        Running test_nogit_1 ... SUCCESS ✓ 
Overall result: FAILURE ✗ 

I have something you may want to test in branch quiet_mode. Let me know.

@dalisoft
Copy link
Author

dalisoft commented Mar 4, 2024

@pgrange Yes, it works. Thank you

release-me on  ci-tests [?] via 💎 v3.3.0 
❯ env $(cat .env.test) ROOT_DIR=$(pwd) ./bash_unit -q tests/cli/*.test.sh
Running tests in tests/cli/core.test.sh
Initialized empty Git repository in /private/var/folders/zf/71cnxqxj6nq_m0tzw2gpb03w0000gn/T/tmp.F8q0MahqeC/.git/
        Running test_core_cli_help ... SUCCESS ✓ 
        Running test_core_cli_invalid_arg ... FAILURE ✗ 
        Running test_core_cli_invalid_option ... FAILURE ✗ 
        Running test_core_cli_version ... SUCCESS ✓ 
Running tests in tests/cli/no-git.test.sh
        Running test_nogit_1 ... SUCCESS ✓ 
Overall result: FAILURE ✗ 

@pgrange
Copy link
Owner

pgrange commented Mar 4, 2024

Perfect 🎉

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