Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An Hspec formatter that produces a JUnit XML file of results
-- file test/SpecHook.hs
module SpecHook where
import Test.Hspec
import Test.Hspec.JUnit.Config
import Test.Hspec.JUnit.Formatter qualified as Formatter
-- | To only produce a JUnit file, silencing other output
hook :: Spec -> Spec
hook = Formatter.use defaultJUnitConfig
-- | To produce a JUnit file in addition to the normal output
hook :: Spec -> Spec
hook = Formatter.add defaultJUnitConfig
-- | To only produce, but only when --format=junit
is used
hook :: Spec -> Spec
hook = Formatter.register defaultJUnitConfig
See also,
- https://hspec.github.io/hspec-discover.html#spec-hooks
- https://hspec.github.io/extending-hspec-formatter.html#packaging-a-formatter-for-distribution-and-reuse
For a version that reads configuration from JUNIT_
environment variables,
see Test.Hspec.JUnit.Formatter.Env.
Synopsis
- use :: JUnitConfig -> SpecWith a -> SpecWith a
- add :: JUnitConfig -> SpecWith a -> SpecWith a
- register :: JUnitConfig -> SpecWith a -> SpecWith a
- formatter :: JUnitConfig -> (String, FormatConfig -> IO Format)
- module Test.Hspec.JUnit.Config
- module Test.Hspec.Api.Format.V1
Documentation
use :: JUnitConfig -> SpecWith a -> SpecWith a Source #
Register junit
as an available formatter and use it by default
add :: JUnitConfig -> SpecWith a -> SpecWith a Source #
Register junit
, and use it in addition to the default
register :: JUnitConfig -> SpecWith a -> SpecWith a Source #
Register junit
, but do not change the default
formatter :: JUnitConfig -> (String, FormatConfig -> IO Format) Source #
module Test.Hspec.JUnit.Config
module Test.Hspec.Api.Format.V1