I have a cabal package for which I have a test-suite
set up using the exitcode-stdio-1.0
type, like so:
When I run it using cabal test
, cabal does not print the standard output/standard error of the executable; it only prints its own logging information:
$ cabal test
Running 1 test suites...
Test suite test-foo: RUNNING...
Test suite test-foo: PASS
Test suite logged to: dist/test/foo-0.0.1-test-foo.log
1 of 1 test suites (1 of 1 test cases) passed.
$
The output that I want is in that log file:
$ cat dist/test/foo-0.0.1-test-fo.log
Test suite test-foo: RUNNING...
HUnit group 1:
Expected connect: [OK]
Test Cases Total
Passed 1 1
Failed 0 0
Total 1 1
Test suite test-foo: PASS
Test suite logged to: dist/test/foo-0.0.1-test-foo.log
$
How do I get cabal to print this output to its own standard output? I can't find it in the documentation.
If you are using Cabal new-test (defualt on Cabal 3+):
$ cabal new-test --test-show-details=streaming
Older Cabal versions allow the output to be streamed using:
$ cabal test --show-details=streaming
--show-details=filter
Determines if the results of individual test cases are shown on the terminal. May be always (always show), never (never show), failures (show only failed results), or streaming (show all results in real time).
Read more in the Cabal User Guide.
There has been a new way for a few months, and tests results are even written to stdout on the file, not flushed at the end
cabal test --show-details=streaming
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With