Modulehspec-2.11.14Haskell2010
Test.Hspec.Runner
- 10 types
- 21 values
- Packagehspec-2.11.14
- Exports31
- LanguageHaskell2010
- LicenceMIT
- SourceMonad.hs
A SpecWith a represents a test or group of tests that require an a
value to run.
In the common case, a Spec is a SpecWith () which requires () and
can thus be executed with hspec.
To supply an argument to SpecWith tests to turn them into Spec, use functions from Test.Hspec.Core.Hooks such as around, before, mapSubject and similar.
Values of this type are created by it, describe and similar.
Run a given spec and write a report to stdout. Exit with exitFailure if at least one spec item fails.
Note: hspec handles command-line options and reads config files. This is not always desirable. Use evalSpec and runSpecForest if you need more control over these aspects.
Run given spec with custom options. This is similar to hspec, but more flexible.
Constructors
ConfigconfigIgnoreConfigFile :: BoolconfigDryRun :: BoolconfigFocusedOnly :: BoolconfigFailOnEmpty :: BoolconfigFailOnFocused :: BoolconfigFailOnPending :: BoolconfigFailOnEmptyDescription :: BoolconfigPrintSlowItems :: Maybe IntconfigPrintCpuTime :: BoolconfigFailFast :: BoolconfigRandomize :: BoolconfigSeed :: Maybe IntegerconfigQuickCheckSeed :: Maybe IntegerconfigFailureReport :: Maybe FilePathconfigRerun :: BoolconfigRerunAllOnSuccess :: BoolconfigFilterPredicate :: Maybe (Path -> Bool)configSkipPredicate :: Maybe (Path -> Bool)configQuickCheckMaxSuccess :: Maybe IntconfigQuickCheckMaxDiscardRatio :: Maybe IntconfigQuickCheckMaxSize :: Maybe IntconfigQuickCheckMaxShrinks :: Maybe IntconfigSmallCheckDepth :: Maybe IntconfigColorMode :: ColorModeconfigUnicodeMode :: UnicodeModeconfigDiff :: BoolconfigDiffContext :: Maybe IntconfigExternalDiff :: Maybe (Maybe Int -> String -> String -> IO ())configPrettyPrint :: BoolconfigPrettyPrintFunction :: Bool -> String -> String -> (String, String)configFormatException :: SomeException -> StringconfigTimes :: BoolconfigExpertMode :: BoolconfigAvailableFormatters :: [(String, FormatConfig -> IO Format)]configFormat :: Maybe (FormatConfig -> IO Format)configFormatter :: Maybe FormatterconfigHtmlOutput :: BoolconfigConcurrentJobs :: Maybe IntconfigAnnotations :: Annotations
Add a filter predicate to config. If there is already a filter predicate, then combine them with ||.
readConfig parses config options from several sources and constructs a Config value. It takes options from:
~/.hspec(a config file in the user's home directory).hspec(a config file in the current working directory)the provided list of command-line options (the second argument to
readConfig)
(precedence from low to high)
When parsing fails then readConfig writes an error message to stderr and
exits with exitFailure.
When --help is provided as a command-line option then readConfig writes
a help message to stdout and exits with exitSuccess.
A common way to use readConfig is:
getArgs >>= readConfig defaultConfig
Instances2Eq, Show
Eq UnicodeModeDefined in hspec-core-2.11.14 · Test.Hspec.Core.Config.DefinitionShow UnicodeModeDefined in hspec-core-2.11.14 · Test.Hspec.Core.Config.Definition
Instances2Eq, Show
Eq ResultItemDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.ResultShow ResultItemDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.Result
Instances2Eq, Show
Eq ResultItemStatusDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.ResultShow ResultItemStatusDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.Result
Instances2Eq, Show
Eq SpecResultDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.ResultShow SpecResultDefined in hspec-core-2.11.14 · Test.Hspec.Core.Runner.Result
Summary of a test run.
Constructors
Instances4Eq, Show, Semigroup, Monoid
A Path describes the location of a spec item within a spec tree.
It consists of a list of group descriptions and a requirement description.
Deprecated. Use useFormatter instead.
Make a formatter available for use with --format and use it by default.
Deprecated. Use registerFormatter instead.
Make a formatter available for use with --format.
Exit with exitFailure if the given Summary indicates that there was at least one failure.
Run given spec and returns a summary of the test run.
Note: hspecResult does not exit with exitFailure on failing spec items. If you need this, you have to check the Summary yourself and act accordingly.
Run given spec with custom options and returns a summary of the test run.
Note: hspecWithResult does not exit with exitFailure on failing spec items. If you need this, you have to check the Summary yourself and act accordingly.
Note: runSpec is deprecated. It ignores any modifications applied through modifyConfig. Use evalSpec and runSpecForest instead.
runSpecForest is the most basic primitive to run a spec. hspec is
defined in terms of runSpecForest:
hspec = evalSpec defaultConfig >=> \ (config, spec) ->
getArgs
>>= readConfig config
>>= withArgs [] . runSpecForest spec
>>= evaluateResult