Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dantswain/mix_eunit
A mix task to execute eunit tests.
https://github.com/dantswain/mix_eunit
Last synced: about 2 months ago
JSON representation
A mix task to execute eunit tests.
- Host: GitHub
- URL: https://github.com/dantswain/mix_eunit
- Owner: dantswain
- License: mit
- Created: 2015-01-05T02:55:18.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T19:20:29.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T09:54:00.687Z (2 months ago)
- Language: Elixir
- Size: 25.4 KB
- Stars: 17
- Watchers: 2
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A Mix task to execute eunit tests. (Testing)
- fucking-awesome-elixir - mix_eunit - A Mix task to execute eunit tests. (Testing)
- awesome-elixir - mix_eunit - A Mix task to execute eunit tests. (Testing)
README
MixEunit
========A mix task to execute eunit tests.
* Works in umbrella projects.
* Tests can be in the module or in the test directory.
* Allows the user to provide a list of patterns for tests to run.Example
```
mix eunit # run all the tests
mix eunit --verbose "foo*" "*_test" # verbose run foo*.erl and *_test.erl
```Installation
------------Add to your `mix.exs` deps:
```elixir
def deps
[#... existing deps,
{:mix_eunit, "~> 0.2"}]
end
```Then
```
mix deps.get
mix deps.compile
mix eunit
```To make the `eunit` task run in the `:test` environment, add the following
to the `project` section of you mix file:```elixir
def project
[#... existing project settings,
preferred_cli_env: [eunit: :test]
]
end
```Command line options:
---------------------A list of patterns to match for test files can be supplied:
```
mix eunit foo* bar*
```The runner automatically adds ".erl" to the patterns.
The following command line switch is also available:
* `--verbose`, `-v` - run eunit with the :verbose option
* `--cover`, `-c` - create a coverage report after running the tests
* `--profile`, `-p` - show a list of the 10 slowest tests
* `--start` - start applications after compilation
* `--no-color` - disable color output
* `--force` - force compilation regardless of compilation times
* `--no-compile` - do not compile even if files require compilation
* `--no-archives-check` - do not check archives
* `--no-deps-check` - do not check dependencies
* `--no-elixir-version-check` - do not check Elixir versionProject Settings:
-----------------The following `mix.exs` project settings affect the behavior of `mix eunit`.
```elixir
def project
[
# existing project settings# run the `eunit` task in the `:test` environment
preferred_cli_env: [eunit: :test],# set the output directory for `mix eunit --cover` reports
# the default is `./cover` (same as `mix test --cover`)
test_coverage: [output: "_build/#{Mix.env}/cover"]# set switches that affect every invocation of the eunit task
eunit: [
verbose: false,
cover: true,
profile: true,
start: true,
color: false
]
]
end
```Cover:
------Note that `mix eunit --cover` and `mix test --cover` will not in
general cover the same source code with tests and therefore will
typically generate two independent coverage reports. There may be
some overlap if your eunit and ExUnit tests cover some of the same
code.By default, `mix eunit --cover` produces coverage reports in HTML
format in the same `cover` directory that `mix test --cover` does.
You can override the `mix eunit --cover` output directory in your
`mix.exs` file as described above.Test search path:
-----------------All ".erl" files in the src and test directories are considered.