Handle multi-command resultsets #163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Simplecov supports merging coverage from multiple test suites by writing them
at different command names in the resultset file, then merging them when
building the report.
We were getting this for free pre-1.0 because the resultsets would be merged
before being passed to the custom formatter. Post-1.0 we were (mistakenly)
assuming it'd just be one command name in the JSON file, hence we were only
reading:
discarding all but the first command-name.
This is both broken and more work than we need to do. The file has a
well-defined schema, and we can rely more on Simplcov for parsing it.
Something like:
would've been functionally equivalent, and shows more clearly the bug. What we
really want is:
Then with an array of results, we can in-line some of Simplecov::ResultMerger
to merge them together into a single Simplecov::Result that we'll format for
upload. Unfortunately, we do have to in-line the method we need because this
object has multiple responsibilities (yay!), including caching and re-writing
files on disk, which we don't want.
Fixes #7
/cc @codeclimate/review
If someone's around and wants to merge / release that'd be great. If not, I'll
pick it up when I'm back next week.