sstephenson / bats

Bash Automated Testing System
MIT License
7.13k stars 517 forks source link

Separate stdout and stderr from the run output #231

Closed Marthym closed 3 years ago

Marthym commented 7 years ago

Put all tested method output in the same variable is an alteration of the real method result. For exemple :

testedMethod() {
  echo "the result"
  (>&2 echo "some log informations")
  return 0
}
value=$(testedMethod)

value contain only "the result" and when I use it in a script I'm only interested in "the result". But it's not possible to assert only the stdout. It should be possible to assert separatly stdout and stderr.

That's why I propose this update. In order to keep compatibility I juste add variables :

ggiamarchi commented 5 years ago

Any chance to see that PR merged?

xmik commented 5 years ago

This repository is not actively maintained anymore, see a discussion here: https://github.com/sstephenson/bats/issues/150#issuecomment-395835936

Try https://github.com/bats-core/bats-core

ggiamarchi commented 5 years ago

Good to know. What a pity it's not explicitly mentioned at the very beginning of the README.

Thank you @xmik

xmik commented 5 years ago

There are already at least 2 PRs trying to accomplish just that (to update README): https://github.com/sstephenson/bats/pull/248 and https://github.com/sstephenson/bats/pull/269 but no success so far