Skip to content

Commit

Permalink
Merge pull request #79 from RobertDober/master
Browse files Browse the repository at this point in the history
fixing --filter/-f for coveralls.detail
  • Loading branch information
parroty authored Oct 11, 2016
2 parents 4ef46a4 + a8f3d43 commit 709adea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/mix/tasks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ defmodule Mix.Tasks.Coveralls do

defp parse_common_options(args, options) do
{common_options, _remaining, unknown_args} = OptionParser.parse(args,
strict: [umbrella: :boolean, verbose: :boolean, pro: :boolean, parallel: :boolean],
aliases: [u: :umbrella, v: :verbose])
{unknown_args |> Enum.map(fn({k, _}) -> k end), options ++ common_options}
strict: [filter: :string, umbrella: :boolean, verbose: :boolean, pro: :boolean, parallel: :boolean],
aliases: [f: :filter, u: :umbrella, v: :verbose])
{
Keyword.keys(unknown_args),
Keyword.merge(options, common_options)
}
end

defp analyze_sub_apps(options) do
Expand Down
6 changes: 6 additions & 0 deletions test/mix/tasks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ defmodule Mix.Tasks.CoverallsTest do
assert(ExCoveralls.ConfServer.get == [type: "local", detail: true, filter: [], args: []])
end

test_with_mock "detail and filter", Runner, [run: fn(_, _) -> nil end] do
Mix.Tasks.Coveralls.Detail.run(["--filter", "x"])
assert(called Runner.run("test", ["--cover"]))
assert(ExCoveralls.ConfServer.get == [type: "local", detail: true, filter: "x", args: []])
end

test_with_mock "html", Runner, [run: fn(_, _) -> nil end] do
Mix.Tasks.Coveralls.Html.run([])
assert(called Runner.run("test", ["--cover"]))
Expand Down

0 comments on commit 709adea

Please sign in to comment.