Giter Site home page Giter Site logo

excoveralls's People

Contributors

albertored avatar andrewdryga avatar ericmj avatar erikreedstrom avatar fenollp avatar fhunleth avatar gabrielrinaldi avatar gmcabrita avatar gmile avatar hez avatar hirotnk avatar joaohf avatar kianmeng avatar leifg avatar ma2gedev avatar nathany avatar nickmerwin avatar parroty avatar pragmaticivan avatar robertdober avatar romankotov avatar satoren avatar slogsdon avatar smeevil avatar sulphur avatar tarzan avatar techgaun avatar tgrk avatar trumant avatar whatyouhide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

excoveralls's Issues

Exit with status 1 when coverage drops below a configurable threshold

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!

Error when changing app env in run-time

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

macros are ignored

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...

2016-07-19 18 33 45

BadFunctionError after proper output (Elixir 0.13.2)

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

excoveralls errors out on Erlang 19

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

Option to ignore files

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.

FunctionClauseError when using meck

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.

Argument error when running mix coveralls on project

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.

Coveralls Badge only Displays Last App Tested in Umbrella App

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.

Add documentation about defaulting to env :dev

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.

Coverage changes when running coveralls vs coveralls.html

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%

Unable to see JSON with `--verbose`

โฏ 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

Umbrella projects do not report numbers overall

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?

[Settings] coveralls.json

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.

hex package 0.2.3 has invalid version inside

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

Ability to configure how output is sorted.

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?

Error when running on Erlang 19.0 / Elixir 1.3.3

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.

MatchError in coveralls.travis on travis

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

excoveralls doesn't compile on Elixir 1.1

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

Documentation: include mix coveralls.html preferred_cli_env

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],

Running `mix coveralls` task fails with unclean build director after source-file deletion

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.

** (UndefinedFunctionError) undefined function: __info__/1

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.

.eex template error: no function clause matching in Enum.reverse_slice/3

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.

Possible fix

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).

Replacing curl

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.

0% coverage for 0 missed lines

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.

SQL Sandbox Mode

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

Running mix task in the :dev env results in test deps not being loaded

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

Files to ignore on a Phoenix project

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.

Travis build not working

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

mix coveralls.circle fails

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)

--include tags

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?

Argument error in version 0.3.8

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)

coveralls.detail filtering does not work as documented

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%
----------------

Empty clause not ignored

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.