Mix.Tasks.Espec
Runs 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--format
- choose formatter (‘doc’, ‘html’, ‘json’)--cover
- enable code coverage
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
.
Summary↑
parse_file(file) | |
parse_files(files) | |
run(args) | Callback implementation for |
Functions
Callback implementation for c:Mix.Task.run/1
.