mix espec (ESpec v1.10.0)
View SourceRuns the specs.
This task starts the current application, loads up
spec/spec_helper.exs
and then requires all files matching the
spec/**/_spec.exs
pattern in parallel.
A list of files can be given after the task name in order to select the files to compile:
mix espec spec/some/particular/file_spec.exs
In case a single file is being tested, it is possible pass a specific line number:
mix espec spec/some/particular/file_spec.exs:42
Command line options
--focus
- run examples withfocus
only--silent
- no output--order
- run examples in the order in which they are declared--sync
- run all specs synchronously ignoring 'async' tag--trace
- detailed output--cover
- enable code coverage--only
- run only tests that match the filter--only some:tag
--exclude
- exclude tests that match the filter--exclude some:tag
--string
- run only examples whose full nested descriptions contain string--string 'only this'
--seed
- seeds the random number generator used to randomize tests order--stale
- The --stale command line option attempts to run only those test files which reference modules that have changed since the last time you ran this task with --stale
Configuration
:spec_paths
- list of paths containing spec files, defaults to["spec"]
. It is expected all spec paths to contain aspec_helper.exs
file.:spec_pattern
- a pattern to load spec files, defaults to*_spec.exs
.:test_coverage
- a set of options to be passed down to the coverage mechanism.
Coverage
The :test_coverage
configuration accepts the following options:
:output
- the output for cover results, defaults to"cover"
:tool
- the coverage tool
By default, a very simple wrapper around OTP's cover
is used as a tool,
but it can be overridden as follows:
test_coverage: [tool: CoverModule]
CoverModule
can be any module that exports start/2
, receiving the
compilation path and the test_coverage
options as arguments. It must
return an anonymous function of zero arity that will be run after the
test suite is done or nil
.