Skip to content

Commit

Permalink
Add new enforce_minimum_coverage option, defaulting to true if test…
Browse files Browse the repository at this point in the history
… type in `cobertuna, local, html` for backwards compat.
  • Loading branch information
vereis committed Apr 19, 2023
1 parent 605cca9 commit 4dbe6ad
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/mix/tasks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ defmodule Mix.Tasks.Coveralls do
message: "Please specify 'test_coverage: [tool: ExCoveralls]' in the 'project' section of mix.exs"
end

switches = [filter: :string, umbrella: :boolean, verbose: :boolean, pro: :boolean, parallel: :boolean, sort: :string, output_dir: :string, subdir: :string, rootdir: :string, flagname: :string, import_cover: :string]
switches = [
filter: :string, umbrella: :boolean, verbose: :boolean, pro: :boolean, parallel: :boolean, sort: :string,
output_dir: :string, subdir: :string, rootdir: :string, flagname: :string, import_cover: :string, enforce_minimum_coverage: :boolean
]

aliases = [f: :filter, u: :umbrella, v: :verbose, o: :output_dir]

{args, common_options} = parse_common_options(args, switches: switches, aliases: aliases)
all_options = options ++ common_options
test_task = Mix.Project.config[:test_coverage][:test_task] || "test"
Expand All @@ -47,6 +52,13 @@ defmodule Mix.Tasks.Coveralls do
all_options
end

all_options =
if all_options[:type] in ["local", "html", "cobertura"] do
Keyword.put(all_options, :enforce_minimum_coverage, true)
else
all_options
end

ExCoveralls.ConfServer.start
ExCoveralls.ConfServer.set(all_options ++ [args: args])
ExCoveralls.StatServer.start
Expand Down

0 comments on commit 4dbe6ad

Please sign in to comment.