Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

Generate json output from cover #456

Merged
merged 1 commit into from
Apr 2, 2015
Merged

Generate json output from cover #456

merged 1 commit into from
Apr 2, 2015

Conversation

glyphrider
Copy link
Contributor

In an effort to incorporate output from cover into our automated build (CI) process, I created the ability to export the coverage information to a JSON file. This is done per-module, to simplify cross-application aggregation. added a new option

{cover_export_json,true}.

which should be using in conjunction with {cover_enabled,true}. to produce output file(s) of the form module_name.COVER.json in the .eunit directory.

A retest suite is provided to illustrate the generation of the file(s).

"rebar-cover_compile_opts.config"}].

run(Dir) ->
io:format("run(~p)~n",[Dir]),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use retest_log instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Actually, it probably should have been cleaned up (removed before pushing). The learning curve on retest was a little sharp; I never found any good documentation, so most of this is stolen from the eunit retest.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dave built retest for rebar integration tests, and there is no documentation besides the tests, but for whats it's worth it's very simple.

@ghost
Copy link

ghost commented Feb 18, 2015

Thanks, in addition to the 0fea93c inline comments, please:

  • get rid of the merge commit (see pull-requests-and-branching)
  • rewrite the commit message following writing-commit-messages
  • for consistency, a comma (if not in a string) should be followed by a space
  • add a copyright header in cover_rt.erl
  • append your name in THANKS

@glyphrider
Copy link
Contributor Author

Addressed inline comments, adjusted commit message, improved comma consistency added copyright header, appended name to THANKS, then rebased.

%%
%% rebar: Erlang Build Tools
%%
%% Copyright (c) 2014 Tuncer Ayaz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you mean Brian H. Ward?

{ok, Output} = retest:sh("./rebar -v eunit"),
io:format("output => ~p~n", [Output]),
?assert(check_output(Output, "foo")),
{ok,Listing} = file:list_dir(".eunit"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after comma

@ghost
Copy link

ghost commented Apr 2, 2015

@ferd?

@ferd
Copy link
Contributor

ferd commented Apr 2, 2015

Yes?

@ghost
Copy link

ghost commented Apr 2, 2015

Any thought on this?

@ferd
Copy link
Contributor

ferd commented Apr 2, 2015

I have no way to test this, have no use for the feature personally, but if the code looks clean and it helps people, I see no reason not to introduce it apart from me not knowing what is 'expected correct behaviour' from this item.

@ghost
Copy link

ghost commented Apr 2, 2015

I don't know if there already exists a prior implementation in some cover utils package that might differ in output, but it's simple and seems to be useful for integration in systems that don't have an Erlang term reader.

ferd added a commit that referenced this pull request Apr 2, 2015
Generate json output from cover
@ferd ferd merged commit 65b0f91 into rebar:master Apr 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants