Closed bernardd closed 8 years ago
Thanks again @bernardd ! I do have a high-level question, though.
How will this jive with a project that has mixed erlang and Elixir tests? Probably you'd have to do two separate coverage runs and compare manually?
That's not to say there's any problem with what you've done here - I'm just trying to keep the big picture in my head. It might be worth a disclaimer in the README.
It's a good question. I'm not sure right now since I haven't looked into how mix's built-in test task handles cover data. I suppose the ideal would be to output a .coverdata
file like rebar3 does for each task and aggregate those together to get the final HTML output. If mix already does that, it'll be easy. Otherwise I'll have to have a look at how else to approach it.
Okay, so at a glance it looks like running mix test --cover
seems to just spit out HTML (just like I'm doing). It looks like it's probably possible to replace the default behaviour with something else, but that's starting to get a bit outside the scope of this project :)
@bernardd Thanks for the answers! I agree trying to do anything fancy is scope creep here.
Does the html go in the same directory? Would there be a conflict? Maybe it's possible to set the output directory.
I think at minimum it would be good to leave a blurb in the README about a) the fact that the coverage report is only for the eunit tests (seems obvious but for someone not familiar with Erlang/Elixir/etc this could be confusing), and b) the potential for the coverage output getting overwritten if you run both.
If you don't have time or don't feel like doing that part, just let me know and I'll merge this and then update it myself - I don't mind.
It goes in the same directory, but the files have slightly different names (they include .COVER.
in the middle of the filename because that seems to be the default, whereas the ones mix test
creates do not). I'll add a blurb to the README now - won't take me long.
There we go.
Thanks again @bernardd ! I'll get this merged and do a release ASAP.
This allows
cover
data to be generated when-c
or--compile
is specified.