Ensure that the test environment doesn't leak into the tests

This should get the build green in CI again.
Only use the pretty formatter when attached to a tty
Merge pull request #235 from richo/for_ben/features/ttyless_tests

For ben/features/ttyless tests