hspec-formatter-github-0.1.0.0: A Formatter for hspec that provides Github Actions Annotations
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Hspec.Formatters.GithubAction

Description

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
Synopsis

Documentation

registerGithubActionsAnnotations :: Formatter -> Config -> Config Source #

This function adds the GitHub Annotations to the underlying Formatter

withGithubActionFormatter :: Formatter -> Formatter Source #

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.

Re-exported Formatter