Skip to content

Commit

Permalink
tests: speed up integration tests coverage
Browse files Browse the repository at this point in the history
Previously, .simplecov called `SimpleCov.result` to store the coverage
result, and ignored the return value. `SimpleCov.result`'s return can be
slow to calculate, which wastes a lot of time when it's ignored.

This commit extracts the code needed to store the SimpleCov result from
`SimpleCov.result`, and calls it directly, without doing the busywork to
compute the return value every time.

In my testing, this more than halves the time taken to run all the
integration tests.
  • Loading branch information
alyssais committed Sep 23, 2016
1 parent 759ee58 commit 5f6a8d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Library/Homebrew/.simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ SimpleCov.start do
at_exit do
exit_code = $!.nil? ? 0 : $!.status
$stdout.reopen("/dev/null")
SimpleCov.result # Just save result, but don't write formatted output.

# Just save result, but don't write formatted output.
coverage_result = Coverage.result
SimpleCov.add_not_loaded_files(coverage_result)
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)

exit! exit_code
end
else
Expand Down

0 comments on commit 5f6a8d4

Please sign in to comment.