The tasty-travis package

[ Tags: bsd3, library, testing ] [ Propose Tags ]

Fancy Travis CI output for tasty tests. Features include:


[Skip to Readme]

Properties

Versions 0.1.0, 0.1.1, 0.1.2, 0.2.0 (info)
Dependencies base (>=4.6 && <5), tasty (==0.12.*) [details]
License BSD3
Copyright Copyright © 2017 Merijn Verstraaten
Author Merijn Verstraaten
Maintainer Merijn Verstraaten <merijn@inconsistent.nl>
Category Testing
Home page https://github.com/merijn/tasty-travis
Bug tracker https://github.com/merijn/tasty-travis/issues
Source repository head: git clone ssh://github.com:merijn/tasty-travis.git
head: hg clone https://bitbucket.org/merijnv/tasty-travis
Uploaded Sat Nov 4 23:22:42 UTC 2017 by MerijnVerstraaten
Distributions NixOS:0.2.0
Downloads 125 total (125 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-04 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for tasty-travis-0.2.0

[back to package description]

Tasty Travis: Fancy Travis CI output for tasty tests

BSD3 Hackage Build Status

Tasty Travis provides fancy Tasty test output on Travis CI.

It allows you get coloured test output, folding and collapsing groups of tests, and hiding the output of successful tests.

Example

Here's what an example test.hs might look:

import Data.List
import Data.Ord
import Data.Tagged (Tagged)
import Data.Typeable (Typeable)
import Options.Applicative (switch, long, help)

import Test.Tasty
import Test.Tasty.Options
import Test.Tasty.Travis (travisTestReporter, defaultConfig)
import Test.Tasty.HUnit

newtype EnableTravis = EnableTravis Bool
  deriving (Eq, Ord, Typeable)

instance IsOption EnableTravis where
  defaultValue = EnableTravis False
  parseValue = fmap EnableTravis . safeRead
  optionName = return "enable-travis"
  optionHelp = return "Run Travis tests."
  optionCLParser =
    fmap EnableTravis $
    switch
      (  long (untag (optionName :: Tagged EnableTravis String))
      <> help (untag (optionHelp :: Tagged EnableTravis String))
      )

main = travisTestReporter cfg [] tests
  where
    cfg = defaultConfig { travisTestOptions = setOption (EnableTravis True) }

tests :: TestTree
tests = testGroup "Unit tests"
  [ testCase "List comparison (different length)" $
      [1, 2, 3] `compare` [1,2] @?= GT

  -- the following test does not hold
  , testCase "List comparison (same length)" $
      [1, 2, 3] `compare` [1,2,2] @?= LT
  , askOption $ \(EnableTravis enable) ->
    if enable then travisTests else testGroup "" []
  ]

travisTests :: TestTree
travisTests = testGroup "Travis" [ {- Travis tests here -} ]