From 6b855938951613fda85945578cbe6d9e7475a547 Mon Sep 17 00:00:00 2001
From: Markus Reiter <me@reitermark.us>
Date: Thu, 22 Sep 2016 21:06:51 +0200
Subject: [PATCH] Fix coverage reporting.

---
 Library/Homebrew/.simplecov               |  3 ++-
 Library/Homebrew/cask/Gemfile             |  9 +++++++++
 Library/Homebrew/cask/Gemfile.lock        | 17 ++++++++++++-----
 Library/Homebrew/cask/spec/spec_helper.rb |  1 -
 Library/Homebrew/cask/test/test_helper.rb |  1 -
 Library/Homebrew/test/Gemfile             |  9 +++++----
 Library/Homebrew/test/Gemfile.lock        |  2 +-
 7 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/Library/Homebrew/.simplecov b/Library/Homebrew/.simplecov
index a7758c4486..e53f011cdc 100755
--- a/Library/Homebrew/.simplecov
+++ b/Library/Homebrew/.simplecov
@@ -16,7 +16,7 @@ SimpleCov.start do
   add_filter "/Homebrew/vendor/"
 
   if ENV["HOMEBREW_INTEGRATION_TEST"]
-    command_name ENV["HOMEBREW_INTEGRATION_TEST"]
+    command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$$})"
     at_exit do
       exit_code = $!.nil? ? 0 : $!.status
       $stdout.reopen("/dev/null")
@@ -24,6 +24,7 @@ SimpleCov.start do
       exit! exit_code
     end
   else
+    command_name "#{command_name} (#{$$})"
     # Not using this during integration tests makes the tests 4x times faster
     # without changing the coverage.
     track_files "#{SimpleCov.root}/**/*.rb"
diff --git a/Library/Homebrew/cask/Gemfile b/Library/Homebrew/cask/Gemfile
index e252b5f3d9..cba638dc9b 100644
--- a/Library/Homebrew/cask/Gemfile
+++ b/Library/Homebrew/cask/Gemfile
@@ -12,6 +12,15 @@ group :development do
 end
 
 group :test do
+  # This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve
+  # all issues with parallel tests, uncovered files, and tracked files. Switch
+  # back to stable as soon as v0.12.1 or v0.13.0 is released. For details, see:
+  #  - https://github.com/colszowka/simplecov/pull/513
+  #  - https://github.com/colszowka/simplecov/pull/520
+  gem "simplecov", "0.12.0",
+    git: "https://github.com/colszowka/simplecov.git",
+    branch: "master", # commit 83d8031ddde0927f87ef9327200a98583ca18d77
+    require: false
   gem "codecov", require: false
   gem "minitest", "5.4.1"
   gem "minitest-reporters"
diff --git a/Library/Homebrew/cask/Gemfile.lock b/Library/Homebrew/cask/Gemfile.lock
index fa5dcf9a99..9d53aebf8a 100644
--- a/Library/Homebrew/cask/Gemfile.lock
+++ b/Library/Homebrew/cask/Gemfile.lock
@@ -1,3 +1,13 @@
+GIT
+  remote: https://github.com/colszowka/simplecov.git
+  revision: 83d8031ddde0927f87ef9327200a98583ca18d77
+  branch: master
+  specs:
+    simplecov (0.12.0)
+      docile (~> 1.1.0)
+      json (>= 1.8, < 3)
+      simplecov-html (~> 0.10.0)
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -66,10 +76,6 @@ GEM
       public_suffix (~> 2.0)
       rubocop (~> 0.41.1)
     ruby-progressbar (1.8.1)
-    simplecov (0.12.0)
-      docile (~> 1.1.0)
-      json (>= 1.8, < 3)
-      simplecov-html (~> 0.10.0)
     simplecov-html (0.10.0)
     slop (3.6.0)
     unicode-display_width (1.1.0)
@@ -91,6 +97,7 @@ DEPENDENCIES
   rspec-its
   rspec-wait
   rubocop-cask (~> 0.8.3)
+  simplecov (= 0.12.0)!
 
 BUNDLED WITH
-   1.12.5
+   1.13.1
diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/cask/spec/spec_helper.rb
index 6bb13bdcf1..bfd4407e00 100644
--- a/Library/Homebrew/cask/spec/spec_helper.rb
+++ b/Library/Homebrew/cask/spec/spec_helper.rb
@@ -4,7 +4,6 @@ require "rspec/wait"
 
 if ENV["HOMEBREW_TESTS_COVERAGE"]
   require "simplecov"
-  SimpleCov.command_name "test:cask:rspec"
 end
 
 project_root = Pathname.new(File.expand_path("../..", __FILE__))
diff --git a/Library/Homebrew/cask/test/test_helper.rb b/Library/Homebrew/cask/test/test_helper.rb
index bf557f66bc..3599b43bed 100644
--- a/Library/Homebrew/cask/test/test_helper.rb
+++ b/Library/Homebrew/cask/test/test_helper.rb
@@ -4,7 +4,6 @@ require "pathname"
 
 if ENV["HOMEBREW_TESTS_COVERAGE"]
   require "simplecov"
-  SimpleCov.command_name "test:cask:minitest"
 end
 
 project_root = Pathname.new(File.expand_path("../..", __FILE__))
diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile
index 193604dd79..0a84f8dc29 100644
--- a/Library/Homebrew/test/Gemfile
+++ b/Library/Homebrew/test/Gemfile
@@ -6,13 +6,14 @@ gem "rake", "~> 10.3"
 gem "parallel_tests", "~> 2.9"
 
 group :coverage do
-  # This is SimpleCov v0.12.0 with one PR merged on top, that finally resolves
+  # This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve
   # all issues with parallel tests, uncovered files, and tracked files. Switch
-  # back to stable as soon as v0.12.1 or v0.13.0 is released. See pull request
-  # <https://github.com/Homebrew/legacy-homebrew/pull/48250> for full details.
+  # back to stable as soon as v0.12.1 or v0.13.0 is released. For details, see:
+  #  - https://github.com/colszowka/simplecov/pull/513
+  #  - https://github.com/colszowka/simplecov/pull/520
   gem "simplecov", "0.12.0",
     git: "https://github.com/colszowka/simplecov.git",
-    branch: "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1
+    branch: "master", # commit 83d8031ddde0927f87ef9327200a98583ca18d77
     require: false
   gem "codecov", require: false
 end
diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock
index 841ff0b5cc..ba639d70fc 100644
--- a/Library/Homebrew/test/Gemfile.lock
+++ b/Library/Homebrew/test/Gemfile.lock
@@ -1,6 +1,6 @@
 GIT
   remote: https://github.com/colszowka/simplecov.git
-  revision: 257e26394c464c4ab388631b4eff1aa98c37d3f1
+  revision: 83d8031ddde0927f87ef9327200a98583ca18d77
   branch: master
   specs:
     simplecov (0.12.0)
-- 
GitLab