Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redbug conflicting with cover/excoveralls #30

Open
nietaki opened this issue Mar 26, 2023 · 1 comment
Open

Redbug conflicting with cover/excoveralls #30

nietaki opened this issue Mar 26, 2023 · 1 comment

Comments

@nietaki
Copy link

nietaki commented Mar 26, 2023

Hi,
I'm migrating rexbug to redbug 2.x and I already made the changes to get the basics up and running correctly.

The problem I ran into is that while all the tests run correctly, they fail when running the tests with excoveralls - it seems like redbug isn't able to extract the module/function info for Elixir modules that aren't part of the standard library.

Repro here.

With an elixir module Foo.Bar being defined:

defmodule Foo do
  @moduledoc false
  defmodule Bar do
    @moduledoc false
    def abc() do
    end

    def xyz(_a, _b, _c) do
    end
  end
end

running redbug against it fails:

{:argument_error, :no_matching_functions} = :redbug.start('\'Elixir.Foo.Bar\'')

I verified it's not related the module not being compiled in the test environment or being part of test/support/ as opposed to the main lib/

I suspect that it's caused by coveralls messing with the compilation / code loading, but I don't understand what's happening exactly. I checked that the :cover compile path (as it is used inside coveralls) is included in :code.get_path() and it is - making sure it's the first path in the list doesn't change anything.

If anyone has an idea what can be done (whether is a change to my approach, or patching either coveralls or redbug) so that I can keep the code coverage, I'd appreciate it.

@nietaki nietaki changed the title Redbug conflicting with excoveralls Redbug conflicting with cover/excoveralls Mar 26, 2023
@nietaki
Copy link
Author

nietaki commented Mar 26, 2023

To narrow down the search I replaced ExCoveralls with Mix test.coverage, which uses cover underneath, and the results are the same:

$ mix test test/redbug_repro.exs --cover                                                                                                                                                                                                                                                    2 ↵
Cover compiling modules ...


  1) test base redbug invocation (RexbugIntegrationTest)
     test/redbug_repro.exs:11
     {:argument_error, :no_matching_functions}
     code: assert is_integer(i), inspect({i, p})
     stacktrace:
       test/redbug_repro.exs:13: (test)

.
Finished in 0.06 seconds (0.00s async, 0.06s sync)
2 tests, 1 failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant