A simple console UI.
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.
Report only failed tests.
At the moment, this option only works globally. As an argument to localOption, it does nothing.
Constructors
Instances3Eq, Ord, IsOption
Eq HideSuccessesDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterOrd HideSuccessesDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption HideSuccessesDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
The minimum amount of time a test can take before tasty prints timing information.
Constructors
Instances3Eq, Ord, IsOption
Eq MinDurationToReportDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterOrd MinDurationToReportDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterIsOption MinDurationToReportDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
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.
Constructors
Instances1IsOption
IsOption AnsiTricksDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
Internals
0 declarationsThe following functions and datatypes are internals that are exposed to simplify the task of rolling your own custom console reporter UI.
Output colouring
When to use color on the output
useColor when isTerm decides if colors should be used,
where isTerm indicates whether stdout is a terminal device.
Test failure statistics
Track the number of tests that were run and failures of a TestTree or sub-tree.
Constructors
StatisticsstatTotal :: !IntNumber of active tests (e.g., that match the pattern specified on the commandline), inactive tests are not counted.
statFailures :: !IntNumber of active tests that failed.
Instances2Semigroup, Monoid
Semigroup StatisticsDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterMonoid StatisticsDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
computeStatistics computes a summary Statistics for
a given state of the StatusMap.
Useful in combination with printStatistics.
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.
printStatisticsNoTime reports test success/failure statistics
The colors ImplicitParam controls whether coloured output is used.
Outputting results
TestOutput is an intermediary between output formatting and output printing. It lets us have several different printing modes (normal; print failures only; quiet).
Constructors
PrintTest String (IO ()) (Progress -> IO ()) (Result -> IO ())Printing a test.
PrintHeading String (IO ()) TestOutputPrinting a test group.
SkipInactive test (e.g. not matching the current pattern).
Seq TestOutput TestOutputTwo sets of TestOutput on the same level.
Instances2Semigroup, Monoid
Semigroup TestOutputDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporterMonoid TestOutputDefined in tasty-1.5.3 · Test.Tasty.Ingredients.ConsoleReporter
Build the TestOutput for a TestTree and OptionSet. The colors
ImplicitParam controls whether the output is colored.
foldTestOutput :: Monoid b=> (String -> IO () -> IO Result -> (Result -> IO ()) -> b)Eliminator for test cases. The
IO ()prints the testname. TheIO Resultblocks until the test is finished, returning it's Result. TheResult -> IO ()function prints the formatted output.-> (String -> IO () -> b -> b)Eliminator for test groups. The
IO ()prints the test group's name. Thebis the result of folding the test group.-> TestOutputThe
TestOutputbeing rendered.-> StatusMapThe
StatusMapreceived by the TestReporter-> 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.