-
Notifications
You must be signed in to change notification settings - Fork 517
Bats swallows output in tests #191
Comments
This is intentional. From the wiki:
You can use this to show relevant information on failure. @test 'test-a' {
run bash -c 'echo ERROR; false'
echo "status = ${status}"
echo "output = ${output}"
[ "$status" -eq 0 ]
} Bats will show all output made before the failing assertion. In this case,
Aslo see my answer to your previous question #190. |
Thanks for the quick reply! This is really helpful 👍 Why not make this a bit more visible and/or add your example to the wiki? I'm sure I'm not the first one to run head first into this. Closing this. |
Agreed! This issue is awesome for:
The only thing that’s missing is a high-visibility place for other newcomers to see the solution before they have the same problem. STDOUT and STDERR are important for just about any program that’s likely to use BATS. I think it’s worth doing the equivalent of a “pull quote” from the normal docs. :) |
Yes, this should be more visible. Along with a dozen other gotchas and best practices. But the maintainer does not have enough time. See #150. A number of us volunteered to help out, but no one serious has stepped forward to take over maintenance. I'm not blaming anyone. After all, I'm still in debt with my long list of proposed improvements that I promised. Bats is an important piece of many projects' infrastructure. Too bad that it does not receive enough attention. |
Because of #190, I tried to do the obvious and print
$output
to standard out, butecho
won't actually print anything:this prints nothing to standard out.
Am I missing something? How do you inspect
$output
etc. when a test fails?The text was updated successfully, but these errors were encountered: