Changes in 2.1.7
Changes in 2.1.6
- If there were no previous failures, run all spec items on
Changes in 2.1.5
- Compatibility with QuickCheck-2.8
Changes in 2.1.4
hspec-discoverignore modules with invalid module names, this fixes issues with
flycheck's temporary files
Changes in 2.1.3
- Format source locations like gcc does
Changes in 2.1.2
Changes in 2.1.1
- Add command-line option
Changes in 2.1.0
Changes in 2.0.2
- Indent error messages for failed examples (fixes #186)
- Bring back
Test.Hspec.HUnitand deprecate it to provide a smother upgrade path
Changes in 2.0.1
- Add missing extra source files to for
Changes in 2.0.0
- Split package into
- Allow hooks (
around, etc.) to pass arguments to spec items
- Do not print
-in front of spec items with
Changes in 1.12.4
Changes in 1.12.3
Changes in 1.12.2
IOErrorTypewhen printing uncaught
IOExceptions (see #204)
Changes in 1.12.1
Changes in 1.12.0
- Add optional source location to spec items
- Move item requirement text from
runIOthis is not really needed
- Do not return
hspecWithand accept command-line arguments (the old behavior is still available as
- Omit empty
describegroups from report
- Do not pass position to
Formatter.exampleGroupStarted(we can not support this with the upcomming cleanup actions #188)
- Do not print empty lines before/after spec groups
Changes in 1.11.4
- Make test suite independent from QuickCheck seed (see #187)
Changes in 1.11.3
- Depend on
Changes in 1.11.2
Changes in 1.11.1
specifyas an alias for
Changes in 1.11.0
BuildSpecsconstructor to internal
SpecTreedata structure. This allows you to do
IOwhile constructing the spec tree.
Changes in 1.10.0
- Do not use exception type to distinguish between synchronous/asynchronous exceptions (thanks to Michael Snoyman)
- Do not reexport
- Add show instance for
- Move requirement text from
- Remove deprecated modules and functions
Changes in 1.9.5
- Make sure that ctrl-c works properly with GHC 7.8.* and QuickCheck-2.6
Changes in 1.9.4
- Compatibility with transformers-0.4.0.0
Changes in 1.9.3
- Make internal Tree data structure more strict (#169)
Changes in 1.9.2
- Print type of exceptions that are raised from QuickCheck properties (#94)
Changes in 1.9.1
- Bring back compatibility with older versions of QuickCheck (#166)
Changes in 1.9.0
- Depend on QuickCheck 2.7
Changes in 1.8.3
- Do not use color if
Changes in 1.8.2
--no-mainwhich results in a top-level spec being generated instead of a test driver (thanks @DanielG)
- Make sure that
afteris run on failing tests (see #159)
Changes in 1.8.1
Changes in 1.8.0
aroundfor each single check of a QuickCheck property
- Don't fail if callback is not called in
Changes in 1.7.2
Changes in 1.7.1
shouldContain(thanks to Alfredo Di Napoli)
- When printing progress, skip total if it is 0
- Do not colorize the description/requirement in failure list
Changes in 1.7.0
--depthfor use with
Change in 1.6.2
Changes in 1.6.1
- Allow to specify the output file with
Changes in 1.6.0
- Add support for parallelization
- Change license to MIT
- Add MonadIO instance for FormatM
- Add support for custom formatters to hspec-discover
- Add hspecResult
--rerun+ add documentation (#95)
- Use same
- Add command-line option
--colordoes not accept arguments anymore (#130)
Changes in 1.5.4
- Make sure that QuickCheck is never chatty
- Make sure progress for QuickCheck examples is shown
Changes in 1.5.3
- Print "Randomized with seed ..." only once
Changes in 1.5.2
--seed, it can be used to specify the seed for QuickCheck properties
- Reuse previous seed on
Changes in 1.5.1
- Depend on quickcheck-io
Changes in 1.5.0
- Allow to use expectations as QuickCheck properties (#80)
- Do not suppress output to
- Change type of
- Add the
examplefunction, it fixes the type of an Expectation (#86)
--fail-fast(for consistency with RSpec)
- Do not clutter Cabal test suite logs with QuickCheck output (#112)
- Skip redundant output from QuickCheck failure messages (#102)
Changes in 1.4.5
- hspec-discover now discovers .lhs files, too
Changes in 1.4.4
- Visually distinguish error message from requirements in the summary (#100)
- Print a summary on UserInterrupt/ctrl-c (#107)
Changes in 1.4.3
Changes in 1.4.2
- Properly handle ctrl-c while running QuickCheck properties (#93)
- Default to
--coloris used without argument (#106)
--qc-max-successas an alias for
Changes in 1.4.1
- Used CPU time is now only included in the test summary if run with
Changes in 1.4.0
- We now have a manual at http://hspec.github.io/. The sources are in
doc/. It's still work in progress. Contributions are very welcome!
- The Haddock documentation now indicates the stability of each exposed
Test.Hspecis now considered stable.
hspecnow supports command-line options
--colorcan be used to enable/disable colored output
--formatcan be used to pick a specific formatter
--htmlcan be used to produce an HTML report
--maximum-generated-testscan be used to specify QuickCheck's
--matchonly runs spec items that match a given string
--re-runonly runs spec items that previously failed. This is undocumented, experimental and only works within GHCi (use
- Runner functions exported from
Test.Hspec.Runnernew expect a monadic spec.
fromHUnitTesthas been added. It can be used to run existing HUnit test suites with Hspec.
Exampleinstance for HUnit
Tests has been deprecated.
fromHUnitTestcan be used instead. The primary motivation is, that
fromHUnitTestgives more detailed reporting for nested HUnit test suites.
Test.Hspec.Monadichas been deprecated, all functionality is available through one of
- More of Hspec's internals are now exposed from
- All runner functions for the core spec type (aka as non-monadic spec) have
been deprecated, use e.g.
Test.Hspec.hspec . fromSpecListinstead. The motivation is to provide an API that does not expose colliding names.
- Some other stuff from
Test.Hspec.Corethat collides with other parts of the API has been deprecated. Compatible alternatives are given in each deprecation message.
- The default formatter now produces less whitespace (#73) + other minor improvements
- The formatter API has been revamped.
- The exception type is now printed if an example fails due to an exception (#50)
- The number of pending examples is now printed after each test run (#85)
--verbosehas been added (#87)
Changes in 1.3.0
Test.Hspecnow re-exports the monadic API. If you still use the non-monadic API, you can use
Test.Hspec.Coreas a drop-in replacement.
hspec-expectations, a set of combinators that allow to express expectations about the outcome of code examples, is now included with Hspec. Have a look at the README of
hspec-expectationsfor a short introduction.
hspec-discover, a mechanism for automatic spec discovery, is now an official part of Hspec. Have a look at
hspec-discover's README for a short introduction.
Changes in 1.2.0
hspechas been removed, and
hspecXhas been renamed to
hHspecnow returns a summary of the test run.
The time reporting after a test run is not colored anymore.
Changes in 1.1.3
Test.Hspecwarns now about future changes: It will re-export
Test.Hspec.Monadicin the future. If you still use the non-monadic API, you can either use
Test.Hspec.Coreas a drop-in replacement, or migrate your code to the monadic API.
The monadic API is more stable and easier to use. Now is a good time to switch!
Test.Hspec.Coreis now a proper superset of
Changes in 1.1.2
All descriptions of nested examples are now included in summary for failing examples
contextis now an alias for
Changes in 1.1.1
- Specs from Test.Hspec.Monadic has been renamed to Spec. For backward compatibility Specs is still kept as an alias.
Changes in 1.1.0
The reason for pending examples is now optional
With this change, both of the following code snippets work.
it "some behavior" $ pending -- no reason given
it "some other behavior" $ pending "some reason"
Hspec does not rely on ExistentialQuantification anymore
The type used to represent specs is now abstract
This should give more useful error messages when adapting old specs that use
the non-monadic API for
Several internal types and functions have been deprecated
Those are internal functions, and they will be removed/hidden with the next release. If you use any of those, update your code. If you really need them, open a ticket and describe your use case.
Changes in 1.0.0
Hspec now re-uses QuickCheck's property function
Test.Hspec.QuickCheck.property is now simply a re-exports of
Test.QuickCheck.property. This has the advantage that you do not get a name
collision if you import both,
Better support for nested specs
NOTE: This is a breaking change to the non-monadic API. The monadic API is not affected.
In some situations parent descriptions for nested specs were not included in the generated report. Solving this required a change to the data structure that is used to represent specs (it was not a proper tree, now it is).
Updating specs that use the non-monadic API
The runner functions (
hspecX) now take a list of
The following works with
hspec-0.9, but not with
main = hspecX $ describe "reverse" [ it "reverses a list" $ reverse [1, 2, 3] == [3, 2, 1], it "gives the original list, if applied twice" $ property $ \xs -> reverse (reverse xs) == (xs :: [Int]) ]
hspec-1.0, you need to wrap it into a list.
main = hspecX [ describe "reverse" [ it "reverses a list" $ reverse [1, 2, 3] == [3, 2, 1], it "gives the original list, if applied twice" $ property $ \xs -> reverse (reverse xs) == (xs :: [Int]) ] ]
Specs consisting of several desribes, combined with
to work unchanged. But
descriptions is now a noop, and it will be removed in
a future release. So it is a good idea to drop it.
The following works with both
main = hspecX $ descriptions [ -- descriptions is redundant describe "Foo" [ it "has some behavior" True ] , describe "Bar" [ it "has some behavior" True ] ]
But the following is recommended instead.
main = hspecX [ describe "Foo" [ it "has some behavior" True ] , describe "Bar" [ it "has some behavior" True ] ]
A new monadic API for custom Formatters
For all the details, have a look at the docs.
The total time required to run a spec is now included in the summary
In addition to the used CPU time, the total time required to run a spec is now include in the summary. This is useful for specs that do non-CPU-intensive stuff, or fork subprocesses.