summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-25 16:47:36 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-26 13:34:18 +0100
commit757f53c7004c6af2c4d5ae38e18cf16a2c791179 (patch)
treeff3e198cb450d12bef3e6bbc5d152df7987e674e
parent22b86269db3ba2d7457f0c951f22e5a9f3712103 (diff)
downloadbundler-757f53c7004c6af2c4d5ae38e18cf16a2c791179.tar.gz
Experiment with tracking subprocess coverage
-rw-r--r--.simplecov4
-rw-r--r--spec/support/coverage.rb11
-rw-r--r--spec/support/helpers.rb2
-rw-r--r--spec/support/rubygems_ext.rb1
4 files changed, 17 insertions, 1 deletions
diff --git a/.simplecov b/.simplecov
index 7f7d80ec42..558a75ea29 100644
--- a/.simplecov
+++ b/.simplecov
@@ -8,7 +8,9 @@ else
"regular_specs"
end
-SimpleCov.command_name command_name
+SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
+
+SimpleCov.command_name "#{command_name}_#{$$}"
SimpleCov.start do
add_filter "/bin/"
diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb
new file mode 100644
index 0000000000..9a229109d0
--- /dev/null
+++ b/spec/support/coverage.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require "simplecov"
+
+module SimpleCov
+ class SourceFile
+ def project_filename
+ @filename.sub(Regexp.new("^#{Regexp.escape(SimpleCov.root)}"), "")
+ end
+ end
+end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 151c99c3ff..5a8447eebd 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -121,6 +121,7 @@ module Spec
env["PATH"].gsub!("#{Path.root}/exe", "") if env["PATH"] && system_bundler
requires = options.delete(:requires) || []
+ requires << "support/coverage"
requires << "support/hax"
artifice = options.delete(:artifice) do
@@ -137,6 +138,7 @@ module Spec
requires_str = requires.map {|r| "-r#{r}" }.join(" ")
load_path = []
+ load_path += Dir[Path.base_system_gems.join("gems/{simplecov,docile}*/lib")].map(&:to_s)
load_path << lib unless system_bundler
load_path << spec
load_path_str = "-I#{load_path.join(File::PATH_SEPARATOR)}"
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index edd66278ad..fbb5252bbe 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -18,6 +18,7 @@ module Spec
"builder" => "~> 3.2",
# ruby-graphviz is used by the viz tests
"ruby-graphviz" => nil,
+ "simplecov" => "0.16.1",
}
end