- Compatibility with QuickCheck 2.19
- Compatibility with QuickCheck 2.18
- Add support for MicroHs
- Remove redundant
tf-randomdependency
- Make sure that
--prettycompletes in O(n) time
- Make diff algorithm line based
- Improve pretty-printing of nested records
- Add
--no-rerunand--no-rerun-all-on-success
- Compatibility with GHC 9.12
- Add (experimental) extensions API
- Handle small terminal sizes more gracefully when reporting progress
- Correctly indent multi-line pending messages
- Use "erase in line" ANSI sequence to clear transient output (instead of overwriting it with spaces)
- Compatibility with GHC 9.10.1
- Drop support for GHC 7.10.3
- Make the build pass with QuickCheck 2.15
- Include
--seedin the note on how to rurun a failing item.
- Compatibility with GHC 9.8.1
- Run cleanup actions on
--fail-fast(see #860)
- Add
--show-exceptionsand--display-exceptions
- Depend on
hspec-expectations-0.8.4
- Suppress informational output from QuickCheck when
Test.QuickCheck.Args.chattyisFalse(#840)
- Add
--expertmode
- Depend on
hspec-expectations-0.8.3
- Don't crash when home directories are unsupported (WASM/WASI) (thanks @amesgen)
- Drop support for GHC < 7.10.3
- Improve coloring of whitespace-only segments on
--diff - Add
ColorizedReasonconstructor toFailureReason - Provide a new package
hspec-api, a stable API that can be used to extend Hspec's functionality. - Deprecate
Test.Hspec.Core.Formatters.V1in favor ofTest.Hspec.Api.Formatters.V1 - Add
--fail-on=empty-description - Print slow spec items to
stderrinstead ofstdout - Handle quoting/escaping in
.hspecfiles - Flush output handle after reporting progress on
-fprogress
- Re-export
sequentialfromTest.Hspec - Rerun
beforeAll/afterAllon--rerun-all-on-success(#768)
- Print error message on
-—fail-on=empty - Only fail on
-—fail-on=emptyif at least one spec item has been filtered - Re-export more types from
Test.Hspec.Core.Runner - Fix a pretty-printing bug where
[]would be pretty-printed as"" - Don't pretty-print if the expected and actual value would be equal after pretty-printing
- Prevent deadlocks on unguarded exceptions in runner (#771)
- Add pretty-printing support for rational numbers
- Force / evaluate exceptions recursively (#763)
- Add
xpropandfprop, which usexitandfit(thanks @lehins)
- Do not depend on
ghcfor pretty-printing (#750, #752)
- Suppress excessive diff output (#449)
- Allow the use of an external diff program. This can e.g. be used by
setting
HSPEC_DIFF_COMMAND="diff -u --color -L expected -L actual"orHSPEC_DIFF_COMMAND="git diff" - Do not imply
--fail-on=emptyon--strict
- Add
--fail-on. This subsums--fail-on-focusedand--fail-on-pending. - Add
--fail-on=empty(#650) - Add
registerFormatterandregisterDefaultFormattertoTest.Hspec.Runner. - Revert deprecation of
Test.Hspec.FormattersandTest.Hspec.Core.Formatters. Instead the module documentation now says that they are deprecated in favor ofTest.Hspec.Core.Formatters.V1.
- Make sure that whitespace-only diff output is colorized properly (#660)
- Deprecate
Test.Hspec.FormattersandTest.Hspec.Core.Formatters - Disable (most) warnings in files generated by
hspec-discover(#702)
- Add
--strict - Add
--fail-on-pending - Do not depend on
clock
- Support for GHC 9.4.1
- Generated modules now include an export list
- Fix a deadlock with nested failed
aroundAlls (see #679)
- Allow to transform the config in
SpecM - Allow to customize pretty-printing (via
configPrettyPrintFunction) - Add
getSpecDescriptionPath(#637, thanks @srid) - Do not treat
afterAllas another spec item (fixes #414, #364, #363) - Change type of
paramsSmallCheckDepthto Maybe (see #345)
- Ensure that interim output does not interfere with output from tests This
facilitates using
printwhen debugging test cases.
- Ensure color codes don't span newlines (#346, thanks @robx)
- Disable progress reporting on Buildkite
- Improve error messages on exceptions in hooks
- Assume
--colorby default when running on GitHub Actions. UseHSPEC_COLOR=noor--no-colorto opt out of this behavior. - Disable progress reporting on GitHub Actions.
- Retain source formatting of numbers when pretty-printing.
- Compatibility with GHCJS (see #599)
- Pretty-print Haskell values in failure messages
- Show multi-line diffs for string literals (disable with
--no-pretty)
- Recover unicode from
ExpectedButGot - Preserve unicode in
To rerun use: --match ...output
- Add ASCII fallbacks to "checks" formatter (fixes #512)
- Use
checksformatter by default (to restore the old behavior use--format specdoc) - Allow to extend the list of available formatters for
--format(configAvailableFormatters) - Add
getExpectedTotalCounttoTest.Hspec.Core.Formatters.V2 - Rename
formatConfigItemCounttoformatConfigExpectedTotalCount - Rename
configFastFailtoconfigFailFast
- hspec-core: Include help.txt in package tarball (close #568)
- hspec-discover: Require base >=4.5.0.0 (fixes #554)
- Better support for GHC 9.2.1
- Support for setting options by individual environment variables, e.g.
HSPEC_COLOR=yeswill set--color
- Better support for
--color=autoon Windows - Add support for spec hooks to
hspec-discover(viaSpecHook.hs) - Propagate exceptions from
Test.Hspec.Core.Format.monadic - Re-export
aroundAll_fromTest.Hspec
- Add
mapSubjectandignoreSubject
- Take the environment variable
NO_COLORinto account
- Add
--timesto print times for individual spec items - Add
--print-slow-items - Use
-XNoImplicitPreludeand do not rely onbaseforhspec-discovergenerated test drivers. This ensures full compatibility with custom preludes. - Add new APIs for formatters
Test.Hspec.Core.FormatandTest.Hspec.Core.Formatters.V2 - Add
getItemCounttoFormatterAPI - Add
--qc-max-shrinks(see #380) - Add location information for failing
afterAll-hooks - hspec-discover: Deprecate
--no-mainand--formatter(use--module-nameinstead) (#196) - Remove
--verboseoption (this has been a noop since at least 2013) - Remove
--outoption (use shell output redirection instead)
- Add a new formatter (can be used with
--format checks) - Add
exampleStartedtoFormatterAPI
- Re-export
aroundAllandaroundAllWithfromTest.Hspec
- Add
aroundAll/aroundAllWith(see #255)
- Add
aroundAll_(see #255) - Correctly handle pending for
afterAllactions
- Add
beforeAllWith(see #447)
- Extract source locations from
NoMethodErrorandAssertionFailed
- Apply
--randomizerecursively
- Add
--randomize
- Interrupt diff calculation if it takes longer than two seconds (see #415)
- Add compatibility with QuickCheck 2.13.1 (see #410)
- Add
--focused-only(see #390) - Add
--fail-on-focused(see #389)
- Add
Test.Hspec.Runner.runSpec(see #216)
- Allow to focus individual spec items (see #319)
- Do not calculate diff on
--no-diff(see #332) - Remove deprecated module Test.Hspec.Core
- Extract source locations from RecConError (see #375)
- Add
modifyArgsandmodifyMaxShrinkstoTest.Hspec.QuickCheck(see #380)
- GHC 8.6.1 related changes
- Compatibility with
QuickCheck-2.12
- Use
module[line:column]instead ofmodule:line:columnas default label fordescribe/it(fixes #366)
- Show how to rerun individual spec items on test failures (see #205)
- Treat character escapes like
\NULas single tokens on--diff(see #351) - Allow a
/at the beginning and at the end of an absolute path that is passed to--matchor--skip
- Use module:line:column as default label for describe/it (see #250)
- Warn if user is affected by https://ghc.haskell.org/trac/ghc/ticket/13285 (see #329)
- Disable tests for Test.Hspec.Core.Timer (see #352)
- Add
sequential(see #311) - Add support for
--diffwhenshouldBeis uesd withQuickCheck-properties - Add source locations when
shouldBeis uesd withQuickCheckproperties - Print
QuickChecklabels on success (see #297) - Retain output of
verbose,label,collect,classify, etc. forQuickCheckproperties (see #257) - Extract source location from error / undefined (see #316)
- Parse source locations from pattern match failures
- Include source column when formatting source locations
- Colorize whitespaces with background color instead of foreground color with
--diff - Run
Test.Hspec.Core.Formatters.exampleProgressinFormatMinstead ofIO - Make sure that progress output is always cleared (fixes #301)
- Add location information to
pending(not used by any formatter yet) - Include duration for each spec item in new formatter API (see #315) (not yet exposed)
- Removed deprecated module
Test.Hspec.HUnit, useTest.Hspec.Contrib.HUnitinstead - Deprecate
--out - Remove
BestEffortsource locations
- compatibility with GHC 8.4.1-alpha3
- compatibility with
QuickCheck-2.11.3and up (note thatQuickCheckversions2.11to2.11.2are not fully supported)
- compatibility with the upcoming version
4.11.0.0ofbase
hspec-discover: Sort specs using natural sort order
- Require quickcheck-io >= 0.2.0
- Read command-line options from environment variable
HSPEC_OPTIONS
- Use
--diffby default - Add
--failure-report(see #266)
- Compatibility with HUnit < 1.3
- Read command-line options from config files
~/.hspecand.hspec - Add support for
--diff - Add
xit,xspecify,xdescribeandxcontext(see #252) - Add
--rerun-all-on-success - Report exceptions in
beforeAlloperations only once - Add indentation when actual/expected contain newlines (see #263)
- More graceful shutdown on ctrl-c (see #270)
- Run around-hook for Bool and Result (see #252)
- Include
CHANGES.markdownin package tarball
Internal changes:
- Rename
Failconstructor ofResult-type toFailure - Add
FailureReasontype - Add
Test.Hspec.Core.Spec.safeEvaluateExample
- Compatibility with HUnit 1.5
- Fix build for HUnit < 1.4
- Proper support for GHC 8 call stacks
- Compatibility with QuickCheck-2.9
- Make sure that
cabal haddockworks forhspec-discover - Forward compatibility for HUnit 1.4
- Fix tests for GHC 8.0.1-rc1
- Fix compilation for GHC 8.0.1-rc1
- Make sure that Vim's default
errorformatrecognizes exact locations - GHCJS compatibility
- Add source locations to test
Result
- GHC 7.0.* compatibility
- Make use of GHC 7.10.2 source locations
- Add
--jobs
- Depend on `hspec-expectations-0.7.0"
- Add
beforeAll_
- If there were no previous failures, run all spec items on
--rerun
- Compatibility with QuickCheck-2.8
- Make
hspec-discoverignore modules with invalid module names, this fixes issues withflycheck's temporary files
- Format source locations like gcc does
- Re-export
before_fromTest.Hspec
- Add
before_ - Add command-line option
--skip
- Generalize
after_,afterAll_andaround_
- Indent error messages for failed examples (fixes #186)
- Export
defaultParamsfromTest.Hspec.Core.Example - Bring back
Test.Hspec.HUnitand deprecate it to provide a smother upgrade path
- Add missing extra source files to for
hspec-discover
- Split package into
hspec,hspec-coreandhspec-discover - Allow hooks (
before,around, etc.) to pass arguments to spec items - Do not print
-in front of spec items withspecdocformatter - Move
Test.Hspec.HUnittohspec-contrib
- Add
specGroupandspecItemtoTest.Hspec.Core - Deprecate
Test.Hspec.Core.itandTest.Hspec.Core.describe
- Make
hspec-discoverwork with-XNoImplicitPrelude
- Include
IOErrorTypewhen printing uncaughtIOExceptions (see #204)
- Add
--module-nameoption tohspec-discover(see #168)
- Add optional source location to spec items
- Move item requirement text from
SpecItemconstructor toItemdata type - Remove
BuildSpecsconstructor fromSpecTree, havingrunIOthis is not really needed - Add
mapSpecTreetoTest.Hspec.Core - Add
afterAll(see #188) - Do not return
ResultfromhspecWithand accept command-line options (the old behavior is still available ashspecWithResult) - Rename
configHandletoconfigOutputFile - 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
- Deprecate
Test.Hspec.Formatters.newParagraph
- Make test suite independent from QuickCheck seed (see #187)
- Depend on
hspec-expectations-0.6.1
- Add
beforeAll
- Add
specifyas an alias forit
- Add
BuildSpecsconstructor to internalSpecTreedata structure. This allows you to doIOwhile constructing the spec tree. - Add
runIO
- Do not use exception type to distinguish between synchronous/asynchronous exceptions (thanks to Michael Snoyman)
- Remove
Exampleinstance forTest.HUnit.Test(#101), useTest.Hspec.HUnit.fromHUnitTestinstead. - Do not reexport
propertyfromTest.Hspec.QuickCheck - Move
ProgressCallbackout ofParams - Add show instance for
Params - Move requirement text from
ItemtoSpecItemconstructor - Remove deprecated modules and functions
- Make sure that ctrl-c works properly with GHC 7.8.* and QuickCheck-2.6
- Compatibility with transformers-0.4.0.0
- Make internal Tree data structure more strict (#169)
- Print type of exceptions that are raised from QuickCheck properties (#94)
- Bring back compatibility with older versions of QuickCheck (#166)
- Depend on QuickCheck 2.7
- Do not use color if
TERM=dumb(see #158)
hspec-discovernow accepts--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)
- Add
shouldMatchList
- Run
before/after/aroundfor each single check of a QuickCheck property - Add
Test.Hspec.Core.mapSpecItem - Add
modifyMaxSuccess,modifyMaxDiscardRatioandmodifyMaxSizetoTest.Hspec.QuickCheck - Don't fail if callback is not called in
around hspec-discover: Remove--nestedoptionhspec-discover: IgnoreSpec.hs/Spec.lhs
- Add
afterandaround
- Add
shouldContain(thanks to Alfredo Di Napoli) - When printing progress, skip total if it is 0
- Do not colorize the description/requirement in failure list
- Add
--depthfor use withhspec-smallcheck
- Add
before - Add
--qc-max-discardand--qc-max-size
- Allow to specify the output file with
--out
- Add support for parallelization
- Change license to MIT
- Add MonadIO instance for FormatM
- Add support for custom formatters to hspec-discover
- Add hspecResult
- Rename
--re-runto--rerun+ add documentation (#95) - Remove
configVerbose - Use same
--qc-max-successon--rerun(#125) - Add command-line option
--no-color,--colordoes not accept arguments anymore (#130)
- Make sure that QuickCheck is never chatty
- Make sure progress for QuickCheck examples is shown
- Print "Randomized with seed ..." only once
- Add
--seed, it can be used to specify the seed for QuickCheck properties - Reuse previous seed on
--re-run
- Depend on quickcheck-io
- Allow to use expectations as QuickCheck properties (#80)
- Do not suppress output to
stdout - Change type of
pendingtoExpectation, addpendingWith(#121) - Add the
examplefunction, it fixes the type of an Expectation (#86) - Rename
--fast-failto--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)
- hspec-discover now discovers .lhs files, too
- Visually distinguish error message from requirements in the summary (#100)
- Export
formatExceptionfromTest.Hspec.Formatters - Add
--fast-fail(#82) - Print a summary on UserInterrupt/ctrl-c (#107)
- Add
--dry-run(#111)
- Properly handle ctrl-c while running QuickCheck properties (#93)
- Default to
--color=alwayswhen--coloris used without argument (#106) - treat
--qc-max-successas an alias for--maximum-generated-tests
- Used CPU time is now only included in the test summary if run with
--print-cpu-time.
- We now have a manual at https://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
module.
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'smaxSuccess--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:reload/:main)!
- 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.- The
Exampleinstance for HUnitTests has been deprecated.fromHUnitTestcan be used instead. The primary motivation is, thatfromHUnitTestgives more detailed reporting for nested HUnit test suites. Test.Hspec.Monadichas been deprecated, all functionality is available through one ofTest.Hspec,Test.Hspec.CoreorTest.Hspec.Runner.- More of Hspec's internals are now exposed from
Test.Hspec.Core - 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)
-
Test.Hspecnow re-exports the monadic API. If you still use the non-monadic API, you can useTest.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 ofhspec-expectations] (https://github.com/sol/hspec-expectations#readme) for 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] (https://github.com/hspec/hspec/tree/main/hspec-discover#readme) for a short introduction.
-
hspechas been removed, andhspecXhas been renamed tohspec(see #71) -
hHspecnow returns a summary of the test run. -
The time reporting after a test run is not colored anymore.
-
Test.Hspecwarns now about future changes: It will re-exportTest.Hspec.Monadicin the future. If you still use the non-monadic API, you can either useTest.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 ofTest.Hspec
-
All descriptions of nested examples are now included in summary for failing examples
-
contextis now an alias fordescribe
- Specs from Test.Hspec.Monadic has been renamed to Spec. For backward compatibility Specs is still kept as an alias.
With this change, both of the following code snippets work.
it "some behavior" $
pending -- no reason givenit "some other behavior" $
pending "some reason"This should give more useful error messages when adapting old specs that use
the non-monadic API for hspec-1.0/hspec-1.1.
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.
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, Test.Hspec.QuickCheck and Test.QuickCheck.
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).
The runner functions (hspec, hspecB and hspecX) now take a list of
descriptions.
The following works with hspec-0.9, but not with hspec-1.0.
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])
]
For 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 describes, combined with descriptions, continue
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 hspec-0.9 and hspec-1.0.
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
]
]For all the details, have a look at the [docs] (https://hackage.haskell.org/packages/archive/hspec/latest/doc/html/Test-Hspec-Formatters.html).
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.