hspec-wai icon indicating copy to clipboard operation
hspec-wai copied to clipboard

How to use HSpec.Wai with hspec-discover?

Open mklinik opened this issue 2 years ago • 1 comments

I'm trying to use hspec-discover with HSpec.Wai. The top-level spec items in my FooSpec.hs files are of type spec :: SpecWith (st, Application). I want to use my own Main module and driver, so I generate the test suite like this:

{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=APISpec -optF --no-main #-}

However, hspec-discover generates spec :: Spec in which it tries to run the (st, Application) specs from the test modules.

Is there a way to make hspec-discover generate a spec :: SpecWith (st, Application)? Or do I have to set up my tests differently?

mklinik avatar Mar 16 '23 08:03 mklinik

You probably want to use spec hooks: https://hspec.github.io/hspec-discover.html#spec-hooks

We probably want to add an example to the README. PRs welcome.

sol avatar Sep 15 '23 00:09 sol