haskellhspec

Hspec: How to suppress successful test results


Is there anyway to prevent successful tests from being printed out to screen? At the moment I have a lot of tests with really long inputs and I only really care about seeing the fails?

Edit: I am running my tests with stack test

Solution:

Thanks to the answer from @mb14, I was able to search for what I was looking for.

running your test file directly:

you can use:

runhaskell testfile.hs --format=failed-examples

or

runhaskell testfile.hs -f failed-examples

and to run via stack test:

stack test --test-arguments=--format=failed-examples

source


Solution

  • Have you try --format=failed-examples ? Also the rerun feature allows to only run (and therefore displays) the failing test (from the previous run).

    To use it with stack, you can use the --test-arguments argument

     stack test --test-arguments --format=failed-examples
    

    Or modify the .hspec file using echo --format=failed-examples >> .hspec. You can find here all the differnt ways to specify arguments hspec.