mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 03:32:27 +01:00
Update README to clarify rules about stdout/sterr
A short note in the README to explain that users should not write anything to stdout outside of @test, setup or teardown functions. Also added a link pointing to the wiki where more information is given about how Bats evaluates test files.
This commit is contained in:
parent
0e5e445728
commit
59a83796c1
10
README.md
10
README.md
|
@ -25,6 +25,16 @@ description.
|
|||
Bats is most useful when testing software written in Bash, but you can
|
||||
use it to test any UNIX program.
|
||||
|
||||
**NB**: You can include code in your test file outside of `@test` functions.
|
||||
For example, this may be useful if you want to check for dependencies and
|
||||
fail immediately if they're not present. However, any output that you print
|
||||
in code outside of `@test`, `setup` or `teardown` functions must be
|
||||
redirected to `stderr`. Otherwise, the output will cause Bats to fail by
|
||||
polluting the TAP stream on `stdout`. (For more details about exactly how
|
||||
Bats evaluates test files, see [the wiki][eval].)
|
||||
|
||||
[eval]: https://github.com/sstephenson/bats/wiki/Bats-Evaluation-Process
|
||||
|
||||
Test cases consist of standard shell commands. Bats makes use of
|
||||
Bash's `errexit` (`set -e`) option when running test cases. If every
|
||||
command in the test case exits with a `0` status code (success), the
|
||||
|
|
Loading…
Reference in New Issue
Block a user