Modulehspec-core-2.11.14Haskell2010
Test.Hspec.Core.Formatters.V2
This is an unstable API. Use Test.Hspec.Api.Formatters.V3 instead.
- 11 types
- 36 values
- Packagehspec-core-2.11.14
- Exports47
- LanguageHaskell2010
- LicenceMIT
- SourceV2.hs
Formatters
5 declarationsImplementing a custom Formatter
9 declarationsA formatter is a set of actions. Each action is evaluated when a certain situation is encountered during a test run.
Actions live in the FormatM monad. It provides access to the runner state and primitives for appending to the generated report.
Constructors
FormatterformatterStarted :: FormatM ()formatterGroupStarted :: Path -> FormatM ()formatterGroupDone :: Path -> FormatM ()formatterProgress :: Path -> Progress -> FormatM ()formatterItemStarted :: Path -> FormatM ()formatterItemDone :: Path -> Item -> FormatM ()formatterDone :: FormatM ()
A Path describes the location of a spec item within a spec tree.
It consists of a list of group descriptions and a requirement description.
(CurrentItem, TotalItems) tuple.
Location is used to represent source locations.
Constructors
Constructors
Instances2Show, NFData
Show FailureReasonDefined in hspec-core-2.11.14 · Test.Hspec.Core.ExampleNFData FailureReasonDefined in hspec-core-2.11.14 · Test.Hspec.Core.Example
Instances4Monad, Functor, Applicative, MonadIO
Monad FormatMDefined in hspec-core-2.11.14 · Test.Hspec.Core.Formatters.InternalFunctor FormatMDefined in hspec-core-2.11.14 · Test.Hspec.Core.Formatters.InternalApplicative FormatMDefined in hspec-core-2.11.14 · Test.Hspec.Core.Formatters.InternalMonadIO FormatMDefined in hspec-core-2.11.14 · Test.Hspec.Core.Formatters.Internal
Accessing config values
Constructors
FormatConfigformatConfigUseColor :: BoolformatConfigReportProgress :: BoolformatConfigOutputUnicode :: BoolformatConfigUseDiff :: BoolformatConfigDiffContext :: Maybe IntformatConfigExternalDiff :: Maybe (String -> String -> IO ())formatConfigPrettyPrint :: BoolformatConfigPrettyPrintFunction :: Maybe (String -> String -> (String, String))formatConfigFormatException :: SomeException -> StringformatConfigPrintTimes :: BoolformatConfigHtmlOutput :: BoolformatConfigPrintCpuTime :: BoolformatConfigUsedSeed :: IntegerformatConfigExpectedTotalCount :: IntformatConfigExpertMode :: Bool
Accessing the runner state
Get the number of successful examples encountered so far.
Get the number of pending examples encountered so far.
Get the number of failed examples encountered so far.
Get the total number of examples encountered so far.
Get the number of spec items that will have been encountered when this run completes (if it is not terminated early).
Get the list of accumulated failure messages.
The random seed that is used for QuickCheck.
Instances6Eq, Fractional, Num, Ord, Show, PrintfArg
Eq SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.ClockFractional SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.ClockNum SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.ClockOrd SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.ClockShow SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.ClockPrintfArg SecondsDefined in hspec-core-2.11.14 · Test.Hspec.Core.Clock
Get the used CPU time since the test run has been started.
Get the passed real time since the test run has been started.
Appending to the generated report
Append some output to the report.
The same as write, but adds a newline character.
Dealing with colors
Set output color to cyan, run given action, and finally restore the default color.
Set output color to green, run given action, and finally restore the default color.
Set output color to yellow, run given action, and finally restore the default color.
Set output color to red, run given action, and finally restore the default color.
Return the value of Test.Hspec.Core.Runner.configDiffContext.
Deprecated. use prettyPrintFunction instead
Return a function for pretty-printing if the user requested pretty diffs, Nothing otherwise.
Output given chunk in red.
Output given chunk in green.
expert mode
Do nothing on `--expert`, otherwise run the given action.
Helpers
The function formatException converts an exception to a string.
This is different from show. The type of the exception is included, e.g.:
formatException (toException DivideByZero)"ArithException\ndivide by zero"
For IOExceptions the IOErrorType is included, as well.