HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletasty-1.5.3Haskell2010

Test.Tasty.Ingredients.ConsoleReporter

Console reporter ingredient.

  • 7 types
  • 9 values
  • Packagetasty-1.5.3
  • Exports16
  • LanguageHaskell2010
  • LicenceMIT
  • SourceConsoleReporter.hs

A simple console UI with a hook to postprocess results, depending on their names and external conditions (e. g., its previous outcome, stored in a file). Names are listed in reverse order: from test's own name to a name of the outermost test group.

newtypenewtype Quiet
#

Do not print test results (see README for details).

Constructors

Instances3Eq, Ord, IsOption
  • Eq QuietDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
  • Ord QuietDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
  • IsOption QuietDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
newtypenewtype AnsiTricks
#

By default, when the option --hide-successes is given and the output goes to an ANSI-capable terminal, we employ some ANSI terminal tricks to display the name of the currently running test and then erase it if it succeeds.

These tricks sometimes fail, however—in particular, when the test names happen to be longer than the width of the terminal window. See

When that happens, this option can be used to disable the tricks. In that case, the test name will be printed only once the test fails.

Instances1IsOption

Internals

0 declarations

The following functions and datatypes are internals that are exposed to simplify the task of rolling your own custom console reporter UI.

Output colouring

datadata UseColor
#

When to use color on the output

Constructors

Instances3Eq, Ord, IsOption
  • Eq UseColorDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
  • Ord UseColorDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
  • IsOption UseColorDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter

    Control color output

valueuseColor :: UseColor -> Bool -> Bool
#

useColor when isTerm decides if colors should be used, where isTerm indicates whether stdout is a terminal device.

Test failure statistics

datadata Statistics
#

Track the number of tests that were run and failures of a TestTree or sub-tree.

Constructors

  • Statistics
    • statTotal :: !Int

      Number of active tests (e.g., that match the pattern specified on the commandline), inactive tests are not counted.

    • statFailures :: !Int

      Number of active tests that failed.

Instances2Semigroup, Monoid
valueprintStatistics :: IP "colors" Bool => Statistics -> Time -> IO ()
#

printStatistics reports test success/failure statistics and time it took to run. The Time results is intended to be filled in by the TestReporter callback. The colors ImplicitParam controls whether coloured output is used.

valueprintStatisticsNoTime :: IP "colors" Bool => Statistics -> IO ()
#

printStatisticsNoTime reports test success/failure statistics The colors ImplicitParam controls whether coloured output is used.

Outputting results

datadata TestOutput
#

TestOutput is an intermediary between output formatting and output printing. It lets us have several different printing modes (normal; print failures only; quiet).

Constructors

Instances2Semigroup, Monoid
valuefoldTestOutput
  1. :: Monoid b
  2. => (String -> IO () -> IO Result -> (Result -> IO ()) -> b)

    Eliminator for test cases. The IO () prints the testname. The IO Result blocks until the test is finished, returning it's Result. The Result -> IO () function prints the formatted output.

  3. -> (String -> IO () -> b -> b)

    Eliminator for test groups. The IO () prints the test group's name. The b is the result of folding the test group.

  4. -> TestOutput

    The TestOutput being rendered.

  5. -> StatusMap

    The StatusMap received by the TestReporter

  6. -> b
#

Fold function for the TestOutput tree into a Monoid.

Run action with console configured for a specific output format

This function does not apply any output formats if colors are disabled at command line or console detection.

Can be used by providers that wish to provider specific result details printing, while re-using the tasty formats and coloring logic.