codeclimate / test-reporter

Code Climate Test Reporter
MIT License
155 stars 76 forks source link

Add support for simplecov's new expected JSON output #441

Closed fede-moya closed 3 years ago

fede-moya commented 4 years ago

Following https://github.com/codeclimate/test-reporter/issues/413, this PR attempts to add support to simplecov 0.20.0 +. As discussed in the issue shared before, the main idea is that simplecov will natively incorporate a JSON formatter, which we will be triggered by default when running simplecov within an environment that has the CC_TEST_REPORTER_ID variable present.

Accordingly, the simplecov formatter will now try to read coverage information from the output of the new simplecov's JSON formatter. This new report will contain more information reporting as "ignored" those lines marked with :nocov:.

The current implementation pretends to maintain support for previous versions, therefore there are two different paths for looking up the json report, the old .resultset.json and the new coverage.json, a priority in order has been given to coverage.json. When a path is given, like when using test-reporter format-coverate -t simplecov -p /some-path the formatter will try to read the indicated information as if was outputted by the new JSON formatter, in case of that not being the case it will fallback to reading as if it has the same format as .resultset.json. The idea is that no one gets affected by this changes.

As a final note, Until https://github.com/simplecov-ruby/simplecov/pull/923 get's merged or a variation of it, It wouldn't make much sense to merge this work, though in theory it wouldn't cause problems to anyone.

Addresses:

Bonus track

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

fede-moya commented 3 years ago

@filipesperandio can I get your review here please ? I'm posting here since I cannot add you as a reviewer, I think it's due to the repo's permissions settings

filipesperandio commented 3 years ago

@fede-moya: You and @noelia-lencina should have write access to the repo now. 🤦

fede-moya commented 3 years ago

Hey @filipesperandio just addressed your comments, thanks for your, as usual, detailed review. I'm just pinging you again in this comment to make some noise on your notifications so it became the first thing you see on Monday and luckily if you have further comments we can address them tomorrow 💪🏼

filipesperandio commented 3 years ago

Worked. 😂