parroty / excoveralls Goto Github PK
View Code? Open in Web Editor NEWCoverage report tool for Elixir with coveralls.io integration.
License: MIT License
Coverage report tool for Elixir with coveralls.io integration.
License: MIT License
It would be great to have Mix tasks like mix coveralls
or mix coveralls.html
to exit with status 1 when coverage drops below a user-defined level on local
tasks. That would be useful to interrupt CI pipelines, for instance.
I'd be glad to help implement this. I took a quick look at the code and it seems most stats are totalled in the ExCoveralls.Local
module. Seems like it would be easy to expose a function there that returns the totals, then use those to get the percentage on the mix task and exit with status 1 if it's below something defined in the coveralls.json
file. On the other hand, it may be worth refactoring some of the calculations that go on in ExCoveralls.Local
so they happen in ExCoveralls.Stats
instead (with Local
invoking those to compose output).
Let me know what you think the best approach is and I can take a stab at it!
mix coveralls
18:33:13.984 [error] Process #PID<0.265.0> raised an exception
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1652: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
(stdlib) epp.erl:1698: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
(stdlib) epp.erl:1690: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
cover.erl:1545: :cover.do_compile_beam1/3
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
** (exit) an exception was raised:
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1652: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
(stdlib) epp.erl:1698: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
(stdlib) epp.erl:1690: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
cover.erl:1545: :cover.do_compile_beam1/3
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
cover.erl:583: :cover.call/1
lib/excoveralls.ex:28: ExCoveralls.start/2
(mix) lib/mix/tasks/test.ex:205: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/task.ex:328: Mix.Task.run_alias/3
(mix) lib/mix/task.ex:261: Mix.Task.run/2
lib/mix/tasks.ex:53: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
18:33:13.987 [error] Process #PID<0.262.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_data_table, {{:bump, AssetProcessor.API, :config_change, 3, 1, 43}, 0})
cover.erl:1789: :cover.munge_body/4
cover.erl:1740: :cover.munge_clauses/4
cover.erl:1719: :cover.munge/4
cover.erl:1635: :cover.transform_2/5
cover.erl:1620: :cover.transform/3
cover.erl:1568: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
18:33:13.987 [error] Process #PID<0.264.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_data_table, {{:bump, AssetProcessor.API.ErrorView, :render, 2, 1, 7}, 0})
cover.erl:1789: :cover.munge_body/4
cover.erl:1740: :cover.munge_clauses/4
cover.erl:1719: :cover.munge/4
cover.erl:1635: :cover.transform_2/5
cover.erl:1620: :cover.transform/3
cover.erl:1568: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
18:33:13.988 [error] Process #PID<0.266.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_data_table, {{:bump, AssetProcessor.API.Validators.BatchUpload, :__info__, 1, 1, 0}, 0})
cover.erl:1789: :cover.munge_body/4
cover.erl:1740: :cover.munge_clauses/4
cover.erl:1719: :cover.munge/4
cover.erl:1635: :cover.transform_2/5
cover.erl:1620: :cover.transform/3
cover.erl:1568: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
18:33:13.988 [error] Process #PID<0.263.0> raised an exception
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1659: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
(stdlib) epp.erl:1698: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
(stdlib) epp.erl:1690: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
cover.erl:1545: :cover.do_compile_beam1/3
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
Does it supposed to be this way?
mix.exs
:
defp deps do
[
...
{:excoveralls, "~> 0.5", only: :test}
]
end
Result:
$ mix coveralls.html
.............
Finished in 0.1 seconds (0.1s on load, 0.02s on tests)
13 tests, 0 failures
Randomized with seed 989620
----------------
COV FILE LINES RELEVANT MISSED
0.0% lib/ecto_autoslug_field.ex 2 0 0
100.0% lib/ecto_autoslug_field/slug.ex 35 2 0
0.0% lib/ecto_autoslug_field/slug_generator.e 48 0 0
0.0% lib/ecto_autoslug_field/type.ex 14 0 0
[TOTAL] 100.0%
----------------
Generating report...
Hi!
After an Elixir upgrade to 0.13.2 from 0.12.5,
I got the following error when running mix coveralls
.
The funny thing is that the output is OK, then there's the error.
Did the guys changed sth in Mix between 0.13.1 (which you have presumably tested looking at the mix.exs) and 0.13.2 ?
[...]
[TOTAL] 42.1%
----------------
** (BadFunctionError) expected a function, got: :ok
(mix) lib/mix/tasks/test.ex:169: Mix.Tasks.Test.run/1
(mix) lib/mix/cli.ex:66: Mix.CLI.run_task/2
(elixir) src/elixir_lexical.erl:17: :elixir_lexical.run/2
(elixir) lib/code.ex:303: Code.require_file/2
Currently there is not a way to pass options to the test task. mix test
has several options.
Of particular interest to me is the --no-start
option to run tests without starting the Application.
See: https://coveralls.io/builds/3214121/source?filename=lib%2Fexdatauri.ex
Lines 30-31 should not be reported as missed (nor executed).
OS: Darwin Kernel Version 15.6.0
Erlang: 19.1
Elixir: 1.3.4
excoveralls: 0.5.7
The mix test
task runs as usual, but running mix coveralls
or mix coveralls.html
Output:
nietaki@silver:mainframe-server (master=)$ mix coveralls
The database for Mainframe.Repo has already been created
17:51:20.966 [error] Process #PID<0.285.0> raised an exception
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
** (exit) an exception was raised:
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
cover.erl:583: :cover.call/1
lib/excoveralls.ex:30: ExCoveralls.start/2
(mix) lib/mix/tasks/test.ex:205: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/task.ex:328: Mix.Task.run_alias/3
(mix) lib/mix/task.ex:261: Mix.Task.run/2
lib/mix/tasks.ex:53: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
17:51:20.975 [error] Process #PID<0.284.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_clause_table, {Mainframe.Emails.Mailer.Address, [{Mainframe.Emails.Mailer.Address, :__info__, 1, 1, 1}, {Mainframe.Emails.Mailer.Address, :__info__, 1, 2, 1}, {Mainframe.Emails.Mailer.Address, :__info__, 1, 3, 1}, {Mainframe.Emails.Mailer.Address, :__struct__, 0, 1, 1}, {Mainframe.Emails.Mailer.Address, :__struct__, 1, 1, 2}]})
cover.erl:1584: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
17:51:20.975 [error] Process #PID<0.287.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_data_table, {{:bump, Mainframe.Models.Subscription, :__info__, 1, 1, 0}, 0})
cover.erl:1789: :cover.munge_body/4
cover.erl:1740: :cover.munge_clauses/4
cover.erl:1719: :cover.munge/4
cover.erl:1635: :cover.transform_2/5
cover.erl:1620: :cover.transform/3
cover.erl:1568: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
17:51:20.976 [error] Process #PID<0.290.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_clause_table, {Mainframe.Uref, [{Mainframe.Uref, :__info__, 1, 1, 1}, {Mainframe.Uref, :__info__, 1, 2, 1}, {Mainframe.Uref, :__info__, 1, 3, 1}, {Mainframe.Uref, :admin_uref, 1, 1, 1}, {Mainframe.Uref, :admin_username, 1, 1, 1}, {Mainframe.Uref, :email, 2, 1, 1}, {Mainframe.Uref, :"MACRO-email_address", 2, 1, 1}, {Mainframe.Uref, :"MACRO-email_cid", 2, 1, 1}, {Mainframe.Uref, :filter_email, 1, 1, 1}, {Mainframe.Uref, :filter_native, 1, 1, 1}, {Mainframe.Uref, :format_uref, 1, 1, 1}, {Mainframe.Uref, :format_uref, 1, 2, 1}, {Mainframe.Uref, :"MACRO-is_admin?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-is_email?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-is_internal?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-is_native?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-is_system?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-is_uref?", 2, 1, 1}, {Mainframe.Uref, :"MACRO-native_uid", 2, 1, 1}, {Mainframe.Uref, :parse_args, 2, 1, 1}, {Mainframe.Uref, :parse_args, 2, 2, 1}, {Mainframe.Uref, :parse_uref, 1, 1, 3}, {Mainframe.Uref, :system_uref, 0, 1, 1}, {Mainframe.Uref, :uid_to_uref, 1, 1, 1}]})
cover.erl:1584: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
17:51:20.977 [error] Process #PID<0.286.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_clause_table, {Mainframe.Models.AccountStorage, [{Mainframe.Models.AccountStorage, :__info__, 1, 1, 1}, {Mainframe.Models.AccountStorage, :__info__, 1, 2, 1}, {Mainframe.Models.AccountStorage, :__info__, 1, 3, 1}, {Mainframe.Models.AccountStorage, :__changeset__, 0, 1, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 1, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 2, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 3, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 4, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 5, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 6, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 7, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 8, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 9, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 10, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 11, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 12, 1}, {Mainframe.Models.AccountStorage, :__schema__, 1, 13, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 1, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 2, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 3, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 4, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 5, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 6, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 7, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 8, 1}, {Mainframe.Models.AccountStorage, :__schema__, 2, 9, 1}, {Mainframe.Models.AccountStorage, :__struct__, 0, 1, 1}, {Mainframe.Models.AccountStorage, :__struct__, 1, 1, 2}, {Mainframe.Models.AccountStorage, :get, 1, 1, 2}, {Mainframe.Models.AccountStorage, :get, 2, 1, 2}, {Mainframe.Models.AccountStorage, :get, 2, 2, 2}, {Mainframe.Models.AccountStorage, :set, 3, 1, 1}, {Mainframe.Models.AccountStorage, :set, 4, 1, 8}]})
cover.erl:1584: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
17:51:20.978 [error] Process #PID<0.288.0> raised an exception
** (ArgumentError) argument error
(stdlib) :ets.insert(:cover_internal_clause_table, {Mainframe.Plug.Forwarded, [{Mainframe.Plug.Forwarded, :__info__, 1, 1, 1}, {Mainframe.Plug.Forwarded, :__info__, 1, 2, 1}, {Mainframe.Plug.Forwarded, :__info__, 1, 3, 1}, {Mainframe.Plug.Forwarded, :call, 2, 1, 7}, {Mainframe.Plug.Forwarded, :init, 1, 1, 1}, {Mainframe.Plug.Forwarded, :ip, 2, 1, 13}, {Mainframe.Plug.Forwarded, :scheme, 2, 1, 1}, {Mainframe.Plug.Forwarded, :scheme, 2, 2, 1}, {Mainframe.Plug.Forwarded, :scheme, 2, 3, 1}]})
cover.erl:1584: :cover.do_compile_beam2/5
cover.erl:1478: :cover.do_compile_beam/3
(stdlib) lists.erl:1239: :lists.map/2
(stdlib) lists.erl:1239: :lists.map/2
cover.erl:2732: anonymous fn/2 in :cover.pmap_spawn/4
(...) - more in this vein
If you try, you get an error:
$ mix coveralls.post TOKENHERE
Test patterns did not match any file: TOKENHERE
It would be useful to be able to ignore specific files. For example files with macros or functions called at compile time.
The option could go into the coveralls.json
. If you agree I can send a PR.
It appears that, at the moment, even if the tests fail we still send coverage. Any thoughts?
I have a test suite in which for some of the tests I mock a module called MyApp.MyProblematicModule
using meck. I am trying to use ExCoveralls for that test suite, but I am failing to even get it running.
This is the error I am getting when I try to run mix coveralls
:
Randomized with seed 857085
** (FunctionClauseError) no function clause matching in List.to_string/1
(elixir) lib/list.ex:619: List.to_string(nil)
lib/excoveralls/cover.ex:20: ExCoveralls.Cover.module_path/1
lib/excoveralls/stats.ex:53: ExCoveralls.Stats.add_counts/4
(elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/excoveralls/stats.ex:28: ExCoveralls.Stats.report/1
lib/excoveralls.ex:35: ExCoveralls.execute/2
(mix) lib/mix/tasks/test.ex:244: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
lib/mix/tasks.ex:53: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
To debug this issue, I added those lines to my test_helper.exs
:
ExCoveralls.Cover.modules |> Enum.each(fn module ->
IO.inspect(module.module_info(:module))
IO.inspect(module.module_info(:compile)[:source])
end)
I have found that there is a module called MyApp.MyProblematicModule_meck_original
whose source is nil
.
My Elixir version is 1.3.2
and my ExCoveralls version is 0.5.6
.
Thanks for the great library, we've pulled it into our project and are planning to use it as a measure of code quality. Particularly love the HTML output.
One issue we've run into, after running mix coveralls
for the first time in a while (it was working fine a week ago). I'll post the error we are seeing then give some background:
16:01:10.683 [error] Process #PID<0.4704.0> raised an exception
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
** (exit) an exception was raised:
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
cover.erl:583: :cover.call/1
lib/excoveralls.ex:28: ExCoveralls.start/2
(mix) lib/mix/tasks/test.ex:193: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
lib/mix/tasks.ex:47: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
Now, we are using the latest version 0.5.5 of ExCoveralls (from Hex). It's on Elixir 1.3.1, and Erlang/OTP 19.
Having done a bit of investigation it seems like things are going wrong at the point of :cover.compile_beam_directory(compile_path |> to_char_list)
in cover.ex. The path to our beam files seems to be okay (_build/test/lib/<our_project>/ebin) but yet the error above is presented.
Our setup is very vanilla in terms of pulling ExCoveralls through Hex, and configuring the deps just as shown in the readme:
test_coverage: [tool: ExCoveralls],
preferred_cli_env: ["coveralls": :test, "coveralls.detail": :test, "coveralls.html": :test, "coveralls.post": :test]
Have you seen anything like this? Any help would be great.
When displaying the coveralls badge we cannot get the badge to display the overall combined test percentage for the entire umbrella app. It is only displaying the last application that was tested.
Now when we run mix coveralls -u
from the command line we get a combined test coverage percentage as we expected.
Has anyone else had this issue? Any input is greatly appreciated.
Thanks for the great work here!
It may be worth documenting that the mix coveralls
command doesn't run in the :test env by default. I mention this as I got some failing tests while running coveralls due to the :dev database having extra content.
Of course MIX_ENV=test mix coveralls
is a very easy solution, but worth mentioning explicitly in the readme. As a beginner with elixir this would be very helpful.
First off, thank you for making such a sweet coverage tool! I'd love to find out why my tests are differing based on how I run them. Here's what's happening.
The coverage seems to change based on whether I run mix coveralls
or mix coveralls.html
. There are no code changes between these two test runs.
This also seems to incorrectly identify as not covered.
schema "project_update_reports" do ... end
When I run MIX_ENV=test mix coveralls
Randomized with seed 163131
----------------
COV FILE LINES RELEVANT MISSED
100.0% web/controllers/project_controller.ex 27 4 0
100.0% web/models/client.ex 23 2 0
100.0% web/models/project.ex 28 2 0
100.0% web/models/project_service.ex 21 3 0
100.0% web/models/project_service_link.ex 20 2 0
100.0% web/models/project_update.ex 21 2 0
50.0% web/models/project_update_report.ex 21 2 1
100.0% web/models/role.ex 21 2 0
100.0% web/models/user.ex 24 3 0
100.0% web/router.ex 57 2 0
100.0% web/uploaders/avatar.ex 32 3 0
100.0% web/uploaders/icon.ex 32 3 0
[TOTAL] 96.7%
When I runMIX_ENV=test mix coveralls.html
Randomized with seed 345244
----------------
COV FILE LINES RELEVANT MISSED
100.0% web/controllers/project_controller.ex 27 4 0
100.0% web/models/client.ex 23 2 0
100.0% web/models/project.ex 28 2 0
100.0% web/models/project_service.ex 21 3 0
50.0% web/models/project_service_link.ex 20 2 1
50.0% web/models/project_update.ex 21 2 1
50.0% web/models/project_update_report.ex 21 2 1
100.0% web/models/role.ex 21 2 0
66.7% web/models/user.ex 24 3 1
100.0% web/router.ex 57 2 0
100.0% web/uploaders/avatar.ex 32 3 0
100.0% web/uploaders/icon.ex 32 3 0
[TOTAL] 86.7%
I'm trying to run mix coveralls.travis command but I've got a error:
~/work/esioci(branch:master) ยป mix coveralls.travis
** (Mix) The task "coveralls.travis" could not be found
I use sample .travis.yml from this repository: https://github.com/parroty/coverage_sample
โฏ MIX_ENV=test mix coveralls --help
-v (--verbose) Show json string for posting.
When I use --verbose or -v I see the usual detail but no JSON.
MIX_ENV=test mix coveralls --verbose
I am running this coverage tool on an umbrella project and each individual sub-project seems to report its numbers but if one sub-project of the umbrella is a dependent on another then overall numbers are incorrect.
Is there a way to support this already?
It would be great if ExCoveralls also supported @stevepeak's Codecov.
https://codecov.io
I'm trying to figure out how to send him some JSON. #61
Hi,
Why didn't you use a dotfile for the coveralls.json?
I come from a ruby background and it seems like services like yours tend to use dotfile for their settings.
Thanks in advance for the answer.
OS: Darwin Kernel Version 15.6.0
Elixir: 1.3.2
Erlang: 18
If send param --filter
in task coveralls.detail
, return is error:
** (Mix) Could not invoke task "test": 1 error found!
--filter : Unknown option
I think if filter param --filter
in https://github.com/parroty/excoveralls/blob/master/lib/mix/tasks.ex#L60 resolve that!
what do you think?
Hi!
Versions not synced - hex package 0.2.3 has version 0.2.4 inside in mix.exs
, preventing it from being installed.
Can you please publish other version or republish that old one with content fixed? TIA
Hi
I am using this project to output html which I view in the browser.
I would like to see the output sorted by coverage percentage rather than by name.
I have looked at various ways to achieve this, from sorting in javascript
, to sorting in eex
in the html template to sorting in ExCoveralls.Stats
.
It makes sense to me that you should be able to configure this as a setting in the json file.
Do you have thoughts on what the best approach would be? Have you considered this and decided against it or has it just not come up?
The coverage outputs fine but there is some kind of error in the ensure_minimum_coverage function.
Finished in 1.3 seconds
28 tests, 0 failures
Randomized with seed 231376
----------------
COV FILE LINES RELEVANT MISSED
84.9% lib/tally.ex 359 119 18
80.0% lib/tally/application.ex 29 5 1
0.0% lib/tally/external/exchange_rates.ex 11 1 1
60.0% lib/tally/handlers/event_handler.ex 40 15 6
88.7% lib/tally/liability.ex 157 53 6
0.0% lib/tally/message/fraction.ex 17 1 1
0.0% lib/tally/message/keywords.ex 19 1 1
0.0% lib/tally/message/placement.ex 45 1 1
0.0% lib/tally/message/placement/selections.e 47 1 1
100.0% lib/tally/message/placement/subselection 20 1 0
0.0% lib/tally/message/settlement.ex 67 1 1
0.0% lib/tally/message/settlement/selections. 49 1 1
100.0% lib/tally/message/settlement/subselectio 16 1 0
16.7% lib/tally/placement_receiver.ex 32 6 5
0.0% lib/tally/settlement_receiver.ex 31 6 6
100.0% lib/tally/structures/id.ex 14 1 0
0.0% lib/tally/structures/meta.ex 12 1 1
100.0% lib/tally/structures/tally.ex 21 1 0
0.0% lib/tally/structures/update.ex 21 1 1
100.0% lib/tally/supervisor.ex 22 2 0
85.7% test/support/tally/producer/backend/test 42 7 1
100.0% test/support/tally/tally.ex 5 1 0
100.0% test/support/tally/telemetry/telemetry.e 22 6 0
88.9% test/support/tally/telemetry/telemetry/s 41 9 1
[TOTAL] 78.1%
----------------
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil
(elixir) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir) lib/enum.ex:116: Enumerable.reduce/3
(elixir) lib/enum.ex:1636: Enum.reduce/3
lib/excoveralls/stats.ex:209: ExCoveralls.Stats.ensure_minimum_coverage/1
(mix) lib/mix/tasks/test.ex:244: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
lib/mix/tasks.ex:53: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
I can't seem to find where it is coming from.
Probably a config issue, but I'm getting a MatchError on travis:
https://travis-ci.org/lpil/dogma/builds/67723421
https://github.com/lpil/dogma/blob/master/.travis.yml
Randomized with seed 67607
** (exit) exited in: :gen_fsm.sync_send_all_state_event(#PID<0.242.0>, {:start, 8000}, :infinity)
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: ""
(ssl) ssl_handshake.erl:1737: :ssl_handshake.dec_hello_extensions/2
(ssl) ssl_handshake.erl:926: :ssl_handshake.decode_handshake/3
(ssl) tls_handshake.erl:155: :tls_handshake.get_tls_handshake_aux/3
(ssl) tls_connection.erl:433: :tls_connection.next_state/4
(stdlib) gen_fsm.erl:503: :gen_fsm.handle_msg/7
(stdlib) proc_lib.erl:237: :proc_lib.init_p_do_apply/3
(stdlib) gen_fsm.erl:242: :gen_fsm.sync_send_all_state_event/3
(ssl) ssl_connection.erl:1654: :ssl_connection.sync_send_all_state_event/2
(ssl) ssl_connection.erl:101: :ssl_connection.handshake/2
(ssl) tls_connection.erl:81: :tls_connection.start_fsm/8
(ssl) ssl_connection.erl:71: :ssl_connection.connect/8
(hackney) src/hackney_connect/hackney_connect.erl:244: :hackney_connect.do_connect/5
(hackney) src/hackney_connect/hackney_connect.erl:41: :hackney_connect.connect/5
(hackney) src/hackney_client/hackney.erl:317: :hackney.request/5
What have I done wrong? :)
Thanks,
Louis
See: https://coveralls.io/builds/3214121/source?filename=lib%2Fexdatauri.ex
Line 89 should be marked as executed.
This may not be ExCoveralls-specific, but it seems lines inside a case
statement are not counted as relevant. This means coverage reports may return 100% coverage even when one of the branches of that case
are not exercised.
I put up a sample repository demonstrating the issue (with instructions on the README file): https://github.com/campezzi/coverage_fail_demo
I'm trying to run sugar with elixir 1.1 and it's failing to compile excoveralls. Here's the error I get when I compile excoveralls by itself.
It would be great if excoveralls worked for the latest version of elixir.
mdg@host:~/src/check/deps/excoveralls$ mix compile
** (Mix) You're trying to run :excoveralls on Elixir v1.1.0-dev but it has declared in its mix.exs file it supports only Elixir ~> 0.13.1
I found it a bit confusing after copy/pasting some config and running:
mix coveralls.html
to get this error:
** (Mix) The task "coveralls.html" could not be found
why not include it in the README:
preferred_cli_env: ["coveralls": :test, "coveralls.detail": :test, "coveralls.html": :test, "coveralls.post": :test],
Hi,
i'm trying use this with travis but I'm getting this error. Could you help me?
The repo is visagio/visag(https://github.com/visagio/visag),
and here the build error: https://travis-ci.org/visagio/visag
I'm compiling before I run the task coveralls.travis
.
My travis.yml.
I'm using a lot of macros, if it's a useful info.
When running mix coveralls
with a dirty build directory, one that contains beam files with missing source files, a File.Error
is raised when ExCoveralls.Stats. get_source_line_count
tries to count the lines of the missing source file. This is more likely with build caching set up in travis.
I would propose that these errors should be handled and displayed as either errors or warnings with a suggestion to clean any _build
directories that are being checked.
I'm also guessing that this would happen anywhere read_source
is called.
Hello,
I'm using excoveralls 0.4.0 with Elixir 1.1.1 and Erlang 18.1 under 64-bit Linux. ๐
Following this guide, I created a src/Elixir.My.List.Lexer.xrl
file containing:
Definitions.
INT = [0-9]+
ATOM = :[a-z_]+
WHITESPACE = [\s\t\n\r]
Rules.
{INT} : {token, {int, TokenLine, list_to_integer(TokenChars)}}.
{ATOM} : {token, {atom, TokenLine, to_atom(TokenChars)}}.
\[ : {token, {'[', TokenLine}}.
\] : {token, {']', TokenLine}}.
, : {token, {',', TokenLine}}.
{WHITESPACE}+ : skip_token.
Erlang code.
to_atom([$:|Chars]) ->
list_to_atom(Chars).
Afterwards, I get the following error when running mix coveralls
: ๐ฑ
$ MIX_ENV=test mix coveralls
Compiled src/Elixir.My.List.Lexer.xrl
Compiled src/Elixir.My.List.Lexer.erl
...
72 tests, 0 failures
Randomized with seed 236840
** (UndefinedFunctionError) undefined function: My.List.Lexer.__info__/1
(yield) My.List.Lexer.__info__(:compile)
lib/excoveralls/cover.ex:19: ExCoveralls.Cover.module_path/1
lib/excoveralls/stats.ex:36: ExCoveralls.Stats.add_counts/4
(elixir) lib/enum.ex:1387: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/excoveralls/stats.ex:11: ExCoveralls.Stats.report/1
lib/excoveralls.ex:29: ExCoveralls.execute/2
(mix) lib/mix/tasks/test.ex:198: Mix.Tasks.Test.run/1
lib/mix/tasks.ex:43: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
exit 1
See also elixir-lang/ex_doc#453 ๐น
Thanks for your consideration.
coveralls 0.5.5
on Erlang/OTP 19
for mix coveralls.html
results in:
** (FunctionClauseError) no function clause matching in Enum.reverse_slice/3
(elixir) lib/enum.ex:1864: Enum.reverse_slice(["cldr.ex", "lib"], 1, #Function<3.4269533/1 in ExCoveralls.Html.View.render/1>)
lib/templates/html/htmlcov/coverage.html.eex:17: anonymous fn/2 in ExCoveralls.Html.View.render/1
The offending line is in coverage.html.eex
:
<% [b | s] = String.split(file.filename, "/") |> Enum.reverse |> Enum.reverse_slice(1, &(&1.length)) %>'
Here the code is calling Enum.reverse_slice(["path", "components"], 1, &(&1.length))
which doesn't make sense to me since the third argument should be a count
which should be an integer. I assume the intent is to dynamically determine the length of the list in the first argument, but this code doesn't do that.
Change line 17 to:
<% parts = String.split(file.filename, "/") %>
<% [b | s] = parts |> Enum.reverse |> Enum.reverse_slice(1, Enum.count(parts))%>
This appears to work (in my system).
I noticed your todos include replacing curl with an Elixir lib. I tried dropping in HTTPotion thinking it would be a quick fix. It turns out HTTPotion isn't sending MIME headers with the request body. Without the headers, Coveralls barfs up a 500. I briefly considered building the headers within excoveralls but that way lies madness.
I may poke at this a bit more later in the week; I just wanted to give you a heads-up.
Hello,
I'm using Elixir 1.1.1 with Erlang 18.1 and ExCoveralls 0.3.11 under 64-bit Linux.
The problem is that 0% coverage is reported for a file with 0 missed lines: ๐ฑ
COV FILE LINES RELEVANT MISSED
0.0% lib/-----------------------------.ex 40 0 0
Shouldn't this be 100% coverage? ๐ฐ
Thanks for your consideration.
Is there any way to turn SQL Sandbox Mode on when running coveralls? (We use it on Travis-CI.)
$ mix coveralls.travis --pro
............
Finished in 6.3 seconds
12 tests, 0 failures
Randomized with seed 398467
17:29:59.943 [error] GenServer #PID<0.637.0> terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.637.0>.
When using ownership, you must manage connections in one
of the three ways:
* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.
The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.
If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.
See Ecto.Adapters.SQL.Sandbox docs for more information.
(db_connection) lib/db_connection.ex:718: DBConnection.checkout/2
(db_connection) lib/db_connection.ex:619: DBConnection.run/3
(db_connection) lib/db_connection.ex:463: DBConnection.prepare_execute/4
(ecto) lib/ecto/adapters/postgres/connection.ex:82: Ecto.Adapters.Postgres.Connection.execute/4
(ecto) lib/ecto/adapters/sql.ex:228: Ecto.Adapters.SQL.sql_call/6
(ecto) lib/ecto/adapters/sql.ex:426: Ecto.Adapters.SQL.struct/6
(ecto) lib/ecto/repo/schema.ex:391: Ecto.Repo.Schema.apply/4
(ecto) lib/ecto/repo/schema.ex:187: anonymous fn/11 in Ecto.Repo.Schema.do_insert/4
(ap_api) lib/parser/batch_parser.ex:45: AssetProcessor.Parser.process_loan/1
(bsoneach) lib/bsoneach.ex:121: BSONEach.apply_callback/2
(bsoneach) lib/bsoneach.ex:77: BSONEach.iterate/4
(bsoneach) lib/bsoneach.ex:50: BSONEach.each/2
(ap_api) lib/parser/batch_parser.ex:30: AssetProcessor.Parser.handle_info/2
(stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:667: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
17:30:00.033 [error] GenServer #PID<0.655.0> terminating
Hello!
Given these deps:
[
{:shouldi, only: :test},
{:excoveralls, only: [:dev,:test]},
]
$ mix coveralls
fails, due to ShouldI
not being loaded in :dev
.
louis ~/projects/dogma [master *] $ mix coveralls
==> idna (compile)
==> ssl_verify_hostname (compile)
==> jsx
Compiled src/jsx_decoder.erl
Compiled src/jsx_encoder.erl
Compiled src/jsx_config.erl
Compiled src/jsx_parser.erl
Compiled src/jsx.erl
Compiled src/jsx_to_term.erl
Compiled src/jsx_verify.erl
Compiled src/jsx_to_json.erl
Generated jsx app
==> exjsx
Compiled lib/jsx.ex
Generated exjsx app
==> hackney (compile)
==> excoveralls
Compiled lib/excoveralls/path_reader.ex
Compiled lib/excoveralls/post.ex
Compiled lib/excoveralls/cover.ex
Compiled lib/excoveralls.ex
Compiled lib/excoveralls/conf_server.ex
Compiled lib/excoveralls/poster.ex
Compiled lib/excoveralls/task/util.ex
Compiled lib/excoveralls/travis.ex
Compiled lib/excoveralls/stop_words.ex
Compiled lib/excoveralls/settings.ex
Compiled lib/excoveralls/stats.ex
Compiled lib/excoveralls/exceptions.ex
Compiled lib/excoveralls/local.ex
Compiled lib/mix/tasks.ex
Generated excoveralls app
==> dogma
Compiled lib/dogma/rules.ex
Compiled lib/dogma/formatter.ex
Compiled lib/dogma/error.ex
Compiled lib/dogma.ex
Compiled lib/dogma/rules/unless_else.ex
Compiled lib/dogma/rules/trailing_whitespace.ex
Compiled lib/dogma/rules/line_length.ex
Compiled lib/mix/tasks/dogma.ex
Compiled lib/dogma/formatter/simple.ex
Compiled lib/dogma/script.ex
Generated dogma app
** (CompileError) test/dogma/formatter/simple_test.exs:2: module ShouldI is not loaded and could not be found
(elixir) expanding macro: Kernel.use/1
test/dogma/formatter/simple_test.exs:2: Dogma.Formatter.SimpleTest (module)
(elixir) lib/code.ex:307: Code.require_file/2
If I run it in :test
, it works. (MIX_ENV=test mix coveralls
)
Thanks,
Louis
See: https://coveralls.io/builds/3214121/source?filename=lib%2Fexdatauri.ex
Line 155 for example was executed by the tests.
I'm trying to figure out which files should be ignored that are generated by Phoenix. Does anyone have a list of files that can safely be ignored?
It would be nice to be able to add a quick coveralls.json
generation task that would ignore files that you don't need to explicitly test in a web app with Phoenix.
Currently it reports that such files have 0% coverage.
Randomized with seed 23244
** (exit) exited in: :gen_fsm.sync_send_all_state_event(#PID<0.441.0>, {:start, 8000}, :infinity)
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: ""
(ssl) ssl_handshake.erl:1737: :ssl_handshake.dec_hello_extensions/2
(ssl) ssl_handshake.erl:926: :ssl_handshake.decode_handshake/3
(ssl) tls_handshake.erl:155: :tls_handshake.get_tls_handshake_aux/3
(ssl) tls_connection.erl:433: :tls_connection.next_state/4
(stdlib) gen_fsm.erl:503: :gen_fsm.handle_msg/7
(stdlib) proc_lib.erl:237: :proc_lib.init_p_do_apply/3
(stdlib) gen_fsm.erl:242: :gen_fsm.sync_send_all_state_event/3
(ssl) ssl_connection.erl:1654: :ssl_connection.sync_send_all_state_event/2
(ssl) ssl_connection.erl:101: :ssl_connection.handshake/2
(ssl) tls_connection.erl:81: :tls_connection.start_fsm/8
(ssl) ssl_connection.erl:71: :ssl_connection.connect/8
(hackney) src/hackney_connect/hackney_connect.erl:241: :hackney_connect.do_connect/5
(hackney) src/hackney_connect/hackney_connect.erl:30: :hackney_connect.connect/5
(hackney) src/hackney_client/hackney.erl:309: :hackney.request/5
Randomized with seed 210845
Successfully uploaded the report to 'https://coveralls.io'.
** (exit) an exception was raised:
** (ArgumentError) argument error
(stdlib) erl_anno.erl:318: :erl_anno.set(:location, -1, [location: -1, generated: true])
(stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
(stdlib) erl_parse.yrl:1645: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1659: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1659: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1637: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1659: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1658: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1648: :erl_parse.modify_anno1/3
(stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
(stdlib) epp.erl:1698: :epp.interpret_file_attr/3
(stdlib) epp.erl:1699: :epp.interpret_file_attr/3
(stdlib) epp.erl:1690: :epp.interpret_file_attr/3
cover.erl:583: :cover.call/1
lib/excoveralls.ex:30: ExCoveralls.start/2
(mix) lib/mix/tasks/test.ex:205: Mix.Tasks.Test.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/project.ex:211: Mix.Project.in_project/4
(elixir) lib/file.ex:1145: File.cd!/2
(mix) lib/mix/task.ex:387: anonymous fn/4 in Mix.Task.recur/1
(elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix) lib/mix/task.ex:386: Mix.Task.recur/1
(mix) lib/mix/project_stack.ex:135: Mix.ProjectStack.recur/1
(mix) lib/mix/task.ex:328: Mix.Task.run_alias/3
(mix) lib/mix/task.ex:261: Mix.Task.run/2
lib/mix/tasks.ex:53: Mix.Tasks.Coveralls.do_run/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
version from iex
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:32:2] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.3.3) - press Ctrl+C to exit (type h() ENTER for help)
See: https://coveralls.io/builds/3214121/source?filename=lib%2Fexdatauri.ex
At line 185, try do
. The 2 blocks inside it are not marked (the tests execute both)
My test helper has the following line to exclude tests that hit remote services by default:
ExUnit.configure(exclude: [:remote])
When I want remote tests I run:
mix test --include remote
What is the equivalent for mix coveralls
?
In version 0.3.8 I'm seeing this error message when trying to mix coveralls
:
** (ArgumentError) argument error
(stdlib) :maps.find("treat_no_relevant_lines_as_covered", [{"treat_no_relevant_lines_as_covered", false}])
lib/excoveralls/local.ex:104: ExCoveralls.Local.default_coverage_value/0
lib/excoveralls/local.ex:75: ExCoveralls.Local.format_info/1
(elixir) lib/enum.ex:977: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:977: Enum.map/2
lib/excoveralls/local.ex:67: ExCoveralls.Local.coverage/1
lib/excoveralls/local.ex:19: ExCoveralls.Local.execute/2
I am not seeing this error in version 0.3.7.
Some information about my environment:
$ iex -S mix
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Interactive Elixir (1.0.3)
The docs say:
Also, displayed source code can be filtered by specifying arguments (it will be matched against the FILE column value).
But when you give a source file name it acts as if it was a test script:
$ mix coveralls.detail lib/stashex/parallel_jobs.ex (07-15 10:34)
lib/stashex/parallel_jobs.ex:1: warning: redefining module Stashex.ParallelJobs
lib/stashex/parallel_jobs.ex:8: warning: redefining module Stashex.ParallelJobs.State
lib/stashex/parallel_jobs.ex:142: warning: default arguments in run_job/3 are never used
Finished in 0.1 seconds (0.1s on load, 0.00s on tests)
0 tests, 0 failures
Randomized with seed 248648
----------------
COV FILE LINES RELEVANT MISSED
0.0% lib/mix/tasks/stashex.load_test.ex 188 58 58
83.3% lib/stashex.ex 35 6 1
0.0% lib/stashex/cache.ex 61 15 15
20.6% lib/stashex/cache_cleaner.ex 103 34 27
0.0% lib/stashex/cluster/dummy.ex 8 0 0
0.0% lib/stashex/cluster/ec2.ex 136 23 23
57.4% lib/stashex/cluster/server.ex 192 54 23
100.0% lib/stashex/cluster/static.ex 15 4 0
0.0% lib/stashex/download.ex 161 36 36
0.0% lib/stashex/download_hub.ex 50 8 8
0.0% lib/stashex/endpoint.ex 19 0 0
0.0% lib/stashex/utils/http.ex 39 10 10
18.2% lib/stashex/utils/phoenix.ex 58 11 9
0.0% lib/stashex/utils/random.ex 13 2 2
0.0% web/controllers/cache_controller.ex 63 11 11
0.0% web/controllers/info_controller.ex 19 2 2
0.0% web/controllers/stashy_controller.ex 31 6 6
0.0% web/router.ex 14 0 0
0.0% web/views/error_view.ex 17 1 1
0.0% web/web.ex 48 1 1
[TOTAL] 17.4%
----------------
And when you give it the test script file, it runs the tests but does not show the detailed coverage informations:
$ mix coveralls.detail test/stashex/parallel_jobs_test.exs (07-15 10:34)
....
Finished in 0.05 seconds (0.04s on load, 0.01s on tests)
4 tests, 0 failures
Randomized with seed 546053
----------------
COV FILE LINES RELEVANT MISSED
0.0% lib/mix/tasks/stashex.load_test.ex 188 58 58
83.3% lib/stashex.ex 35 6 1
0.0% lib/stashex/cache.ex 61 15 15
20.6% lib/stashex/cache_cleaner.ex 103 34 27
0.0% lib/stashex/cluster/dummy.ex 8 0 0
0.0% lib/stashex/cluster/ec2.ex 136 23 23
57.4% lib/stashex/cluster/server.ex 192 54 23
100.0% lib/stashex/cluster/static.ex 15 4 0
0.0% lib/stashex/download.ex 161 36 36
0.0% lib/stashex/download_hub.ex 50 8 8
0.0% lib/stashex/endpoint.ex 19 0 0
87.2% lib/stashex/parallel_jobs.ex 173 47 6
0.0% lib/stashex/utils/http.ex 39 10 10
18.2% lib/stashex/utils/phoenix.ex 58 11 9
0.0% lib/stashex/utils/random.ex 13 2 2
0.0% web/controllers/cache_controller.ex 63 11 11
0.0% web/controllers/info_controller.ex 19 2 2
0.0% web/controllers/stashy_controller.ex 31 6 6
0.0% web/router.ex 14 0 0
0.0% web/views/error_view.ex 17 1 1
0.0% web/web.ex 48 1 1
[TOTAL] 27.4%
----------------
I'm getting a weird issue where an empty clause for a function with a default value and multiple clauses is considered "uncovered" by the library.
My code looks as follows.
def verify(_, _, verifier \\ SomeVerifier)
def verify(_signed_token, [], _verifier), do: {:error, :invalid_token_signature}
def verify(signed_token, [public_key | rest], verifier) do
try do
case verifier.verify_strict(public_key, ["RS256"], signed_token) do
{true, %{fields: claims}, _} -> {:ok, claims}
_ -> verify(signed_token, rest, verifier)
end
rescue
MatchError -> {:error, :invalid_token}
end
end
For some reason excoveralls thinks the first line isn't covered. I know I can work around the issue by using nested case statements or "indirecting" the recursive function by calling a private one (e.g. do_verify
), but I prefer not to do any of that.
Any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.