-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Formatter for hspec that provides Github Actions Annotations -- -- Please see the README on GitHub at -- https://github.com/MercuryTechnologies/hspec-formatter-github#readme @package hspec-formatter-github @version 0.1.0.0 -- | This module is internal! Use at your own risk. Breaking changes to -- this module will not necessarily be reflected in PVP versions. module Test.Hspec.Formatters.GithubAction.Internal -- | This option enhances a given Formatter with annotations that -- will show up on the correct test item failure. This allows you to use -- the test output you want, and additionally get Github Action -- annotations. withGithubActionFormatter :: Formatter -> Formatter -- | A representation of the Github Actions error format. data ErrorCommand ErrorCommand :: Maybe String -> Maybe String -> Maybe Int -> Maybe Int -> String -> ErrorCommand [title] :: ErrorCommand -> Maybe String [file] :: ErrorCommand -> Maybe String [line] :: ErrorCommand -> Maybe Int [col] :: ErrorCommand -> Maybe Int [message] :: ErrorCommand -> String -- | Make a suitable error annotation from an hspec failure. -- -- Not clear what to do with the Maybe Location here: do we use the one -- from the Item, or this one? What if both or neither are available? -- Also not clear whether to use itemInfo. errorCommandFor :: Path -> Item -> Maybe Location -> FailureReason -> ErrorCommand -- | The github actions command format. formatErrorCommand :: ErrorCommand -> String escapeData :: String -> String escapeProperty :: String -> String -- | If you want to extend emitGithubActionAnnotation :: Path -> Item -> FormatM () -- | This module provides a utility to allow you to have annotations on -- test failures in GitHub Actions. -- -- To use this, you'll call registerGithubActionsAnnotations with -- a Formatter of your choice. -- --
-- main :: IO () -- main = do -- let hspecConfig = -- registerGithubActionsAnnotations checks defaultConfig -- hspecWith hspecConfig spec ---- -- This will make the github formatter available. -- -- Then, to actually use the formatter, you can provide the argument -- --format=github on the command line or in a .hspec -- file, or the HSPEC_FORMAT=github environment variable. -- -- To do this locally with cabal, you must use cabal -- run, as cabal test evidently does not allow you to pass -- --test-arguments anymore? -- --
-- $ cabal run $(test-target-name) -- --format=github ---- -- The environment variable is easier to set in CI, probably. -- --
-- $ HSPEC_FORMAT=github cabal test ---- -- And you can use a file, if you really want to, for some reason. -- --
-- $ echo "--format=github" >> .hspec -- $ cabal test --module Test.Hspec.Formatters.GithubAction -- | This function adds the GitHub Annotations to the underlying -- Formatter registerGithubActionsAnnotations :: Formatter -> Config -> Config -- | This option enhances a given Formatter with annotations that -- will show up on the correct test item failure. This allows you to use -- the test output you want, and additionally get Github Action -- annotations. withGithubActionFormatter :: Formatter -> Formatter silent :: Formatter checks :: Formatter