Skip to content

Patch seems to break (or is ignored by) testcoverage tooling? #68

Description

@DGollings

First off, I really liked the API/implementation of Patch. Really enjoy using it so thanks for making it

But whilst experimenting with some code coverage tooling (mix test --cover) noticed that code that uses Patch.patch disappears from the reports.

So decided to clone this repo and noticed the same. Picked a test at random that uses patch(), refute_any_call_test.exs

❯ grep 'patch(' ./test/user/refute_any_call_test.exs
      patch(RefuteAnyCall, :function_with_multiple_arities, :patched)
      (..)
      patch(RefuteAnyCall, :other_function, :patched)
      patch(RefuteAnyCall, :function_with_multiple_arities, :patched)

but then:

mix test --cover 2>&1 | grep RefuteAny

outputs nothing, same for

grep RefuteAnyCall cover -r

which, seeing all the generated html files in cover/ seems unlikely

I assume this is known behaviour? I can imagine its a side-effect of how the 'super-powers' work but are you aware of a workaround or fix? Because its a bit ironic that the most well tested code in my codebase shows up as 0% or not at all :)

And a ps. Running the test directly mix test --cover ./test/user/refute_any_call_test.exs does show the User.Patch modules nearby but almost all of them as 0% coverage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions