From 5f6a8d407aa70b8f83e89a6c8bd8d2b5d619eb0a Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 22 Sep 2016 17:40:52 +0100 Subject: [PATCH] tests: speed up integration tests coverage 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. --- Library/Homebrew/.simplecov | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/.simplecov b/Library/Homebrew/.simplecov index e53f011cdc..bc4ed7bb19 100755 --- a/Library/Homebrew/.simplecov +++ b/Library/Homebrew/.simplecov @@ -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