Silence console output on passing tests #2904
Replies: 2 comments 3 replies
-
Yes that is interesting. I'm not sure how it would work during non-serial tests though. We won't be able to attribute output to a specific passing test, so if there's a failure you may suddenly get a lot of unrelated output. Which I suppose is no worse than what we have now. I'm also not sure how synchronous the logs are and whether we have seen all of it by the time the test ends. Logs can also be used for debugging purposes even when all tests pass. What do you think? |
Beta Was this translation helpful? Give feedback.
-
One use case for this is CI where we run many tests in the same job and the logs are cluttered with useless info. There I only want output for failed tests. I've tried disabling "verbose" but it looks like that option is no longer observed. @novemberborn WDYT of I wouldn't want this to be the default because it's helpful while watching tests to see how they're progressing, and failure can't be known until it's reached. (Though I suppose you could do something with the TTY to output and then hide what was output once it's known to be passing.) |
Beta Was this translation helpful? Give feedback.
-
It would be really cool if Ava silenced console output that happens as a side-effect in passing tests. After all, if a test passes, there is nothing actionable. Console output in those cases is only noise.
This is particularly valuable with tests that validate error throwing with
t.throws
. It is common for code that throws to also output diagnostic and guidance messages to console.error. As a specific example, React adds this additional information to console.error:If a test passes, we have no value in this output, everything works as expected. Thus I think it could be a nice addition to buffer calls to console methods during a test execution and only output them if the test fails.
I suspect it’s possible this has already been considered, and there are some scenarios where such behavior is undesirable, and adding more configuration was decided against. In that case, I apologize. I tried to look for any discussion of this in issues, discussions, and did not find it.
Beta Was this translation helpful? Give feedback.
All reactions