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

How do I run coverage results after using meck? #181

Closed
tommyjcarpenter opened this issue Sep 11, 2017 · 2 comments
Closed

How do I run coverage results after using meck? #181

tommyjcarpenter opened this issue Sep 11, 2017 · 2 comments

Comments

@tommyjcarpenter
Copy link

Going to use my module name of resource_handler as an example.

I'm trying to produce coverage results after using meck, but it shows an error Can't load module resource_handler_meck_original. and then when I go to the coverage URL the link to that mecked module is not clickable.

Reproduction Steps

  1. Have a test using meck to expect a function meck:expect(resource_handler, foo, ...)
  2. rebar3 eunit --cover; rebar3 cover

Expected behavior

resource_handler Coverage results work and are clickable as before I ever used meck

Observed behavior

resource_handler Coverage results do not work; Coverage results for that module show up in the table as
| resource_handler_meck_original | 21% |

But it is not clickable to get the red/black summary of which lines were covered.

Versions

  • Meck version: 0.8.6
  • Erlang version: 19.3.1
@tommyjcarpenter tommyjcarpenter changed the title How do I run coverage results after using mec? How do I run coverage results after using meck? Sep 11, 2017
@tommyjcarpenter
Copy link
Author

hmmmm after some experimentation I seem to have resolved this by making sure I meck:unload at the end of my test.

@eproxus
Copy link
Owner

eproxus commented Sep 12, 2017

@tommyjcarpenter Yeah, it's not until the module is unloaded that the cover results are merged back again. Meck should unload automatically when the test process dies, but perhaps this is too late in this case and you test framework already produced the cover files.

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

2 participants