Skip to content

Commit

Permalink
Merge pull request #50 from vorce/fix_args_passing
Browse files Browse the repository at this point in the history
Make sure additional args can be passed to mix
  • Loading branch information
parroty committed Apr 27, 2016
2 parents 93154d7 + 461b902 commit e675aeb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mix/tasks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ defmodule Mix.Tasks.Coveralls do
end

defp parse_common_options(args, options) do
{common_options, args, _} = OptionParser.parse(args, aliases: [u: :umbrella, v: :verbose])
{args, options ++ common_options}
{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}
end

defp analyze_sub_apps(options) do
Expand Down
10 changes: 10 additions & 0 deletions test/mix/tasks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ defmodule Mix.Tasks.CoverallsTest do
end)
end

test_with_mock "--no-start propagates to mix task", Mix.Task, [run: fn(_, _) -> nil end] do
Mix.Tasks.Coveralls.run(["--no-start"])
assert(called Mix.Task.run("test", ["--cover", "--no-start"]))
end

test_with_mock "--unknown_arg withvalue", Mix.Task, [run: fn(_, _) -> nil end] do
Mix.Tasks.Coveralls.run(["--unknown_arg withvalue", "--second"])
assert(called Mix.Task.run("test", ["--cover", "--unknown_arg withvalue", "--second"]))
end

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

0 comments on commit e675aeb

Please sign in to comment.