tasty-hspec-1.1.5: Hspec support for the Tasty test framework.

Safe HaskellNone
LanguageHaskell2010

Test.Tasty.Hspec

Contents

Description

hspec and tasty serve similar purposes; consider using one or the other.

However, in a pinch, this module allows you to run an hspec Spec as a tasty TestTree.

Synopsis

Tests

testSpecs :: Spec -> IO [TestTree] Source #

Create a list of tasty TestTree from an Hspec Spec. This returns the same tests as testSpec but doesn't create a tasty test group from them.

Options

data TreatPendingAs Source #

How to treat hspec pending tests.

tasty does not have the concept of pending tests, so we must map them to either successes or failures. By default, they are treated as failures.

Set via the command line flag --treat-pending-as (success|failure).

Constructors

Failure 
Success 

Re-exports

module Test.Hspec

Examples

The simplest usage of this library involves first creating a TestTree in IO, then running it with defaultMain.

main = do
  spec <- testSpec "spec" mySpec
  defaultMain
    (testGroup "tests"
      [ spec
      , ...
      ])

However, if you don't do any IO during Spec creation, or the IO need not be performed at any particular time relative to other IO actions, it's perfectly fine to use unsafePerformIO.

main = do
  defaultMain
    (testGroup "tests"
      [ unsafePerformIO (testSpec "spec" mySpec)
      , ...
      ])