shellspec icon indicating copy to clipboard operation
shellspec copied to clipboard

Add flag to suppress warnings

Open AntoniMarcinek opened this issue 5 years ago • 4 comments

While the flag --no-warning-as-failure stops warnings to fail the test suite, it would be still useful to have a flag to remove warnings from reporting altogether. My use case is in the integration tests #121 on executables which tend to print a lot of messages, which I don't want to assert in the test. If I don't assert I still get a lot of printout from shellspec which is of no value to me and hides messages which do contain value (about failures).

AntoniMarcinek avatar Nov 12 '20 13:11 AntoniMarcinek

Certainly, If there is a --no-warning-as-failure, I think there should be a way to suppress the warning. It may be better to suppress each type of warning.

FYI. You could substitute The output should be present or The output should be defined (It's not so clear).

ko1nksm avatar Nov 12 '20 15:11 ko1nksm

I understand that I can suppress the warnings adding one of these two lines. Indeed this is more to the point than The output should not equal "", but if I really don't care if any output is there or not and I have many tests, then writing such lines everywhere doesn't seem elegant. But anyway thanks for the suggestion.

AntoniMarcinek avatar Nov 12 '20 16:11 AntoniMarcinek

It could also be acceptable to just print a message that unexpected output or error is printed by the command under test instead of dumping the output/error along with the warning.

AntoniMarcinek avatar Dec 01 '20 09:12 AntoniMarcinek

This is making my tests pretty verbose too... Currently i HAVE to add The output should be present or The output should be defined as suggested by @ko1nksm.

This is not elegant and it is confusing since it is NOT the actual test, since maybe i could have no output at all and i only care about other tests.

LukeSavefrogs avatar Nov 08 '22 16:11 LukeSavefrogs