Configure ExCoveralls in mix.exs
masterTo use ExCoveralls, you must add it to your project's dependencies and configure the test_coverage and preferred_cli_env keys in your mix.exs file.
Dependency Setup
Add :excoveralls to your deps function, typically restricted to the :test environment:
defp deps do
[
{:excoveralls, "~> 0.18", only: :test}
]
endConfiguration Options
In your project function, you can use the following keys:
test_coverage: [tool: ExCoveralls]: Enables ExCoveralls for coverage reporting.test_coverage: [tool: ExCoveralls, export: "cov"]: Enables reporting and exports data tocover/cov.coverdata.test_coverage: [tool: ExCoveralls, test_task: "espec"]: Use this if you are using Espec instead of the default ExUnit.preferred_cli_env: [coveralls: :test]: (Optional) Allows you to skip specifyingMIX_ENV=testwhen runningmix coverallstasks by setting the default environment.Application.put_env(:excoveralls, :base_path, "/path/to/root"): (Optional) Explicitly sets the application root path. By default, this is the directory containingmix.exs.
def project do
[
app: :excoveralls,
version: "1.0.0",
elixir: "~> 1.0.0",
deps: deps(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.cobertura": :test
]
]
end
defp deps do
[
{:excoveralls, "~> 0.18", only: :test}
]
end