HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulehspec-api-2.11.18Haskell2010

Test.Hspec.Api.Formatters.V2

This module contains formatters that can be used with hspecWith:

import Test.Hspec
import Test.Hspec.Api.Formatters.V1

main :: IO ()
main = hspecWith (useFormatter ("my-formatter", formatter) defaultConfig) spec

formatter :: Formatter
formatter = ...

spec :: Spec
spec = ...
Contents
  1. Register a formatter
  2. Formatters
  3. Implementing a custom Formatter
  4. Accessing the runner state
  5. Appending to the generated report
  6. Dealing with colors
  7. Helpers
  8. Re-exports
Synopsis

Register a formatter

Formatters

Implementing a custom Formatter

A 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.

typetype Path = ([String], String)

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.

newtypenewtype FormatM a
#
Instances4Monad, Functor, Applicative, MonadIO
  • Monad FormatMDefined in hspec-core-2.11.18 · Test.Hspec.Core.Formatters.Internal
  • Functor FormatMDefined in hspec-core-2.11.18 · Test.Hspec.Core.Formatters.Internal
  • Applicative FormatMDefined in hspec-core-2.11.18 · Test.Hspec.Core.Formatters.Internal
  • MonadIO FormatMDefined in hspec-core-2.11.18 · Test.Hspec.Core.Formatters.Internal

Accessing the runner state

newtypenewtype Seconds
#

Constructors

Instances6Eq, Fractional, Num, Ord, Show, PrintfArg
  • Eq SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
  • Fractional SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
  • Num SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
  • Ord SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
  • Show SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock
  • PrintfArg SecondsDefined in hspec-core-2.11.18 · Test.Hspec.Core.Clock

Appending to the generated report

Dealing with colors

Helpers

Re-exports