Merge pull request #773 from reitermarkus/report-cask-coverage
Also report Cask coverage.
This commit is contained in:
commit
0dc0bc1617
@ -1,6 +0,0 @@
|
|||||||
SimpleCov.start do
|
|
||||||
add_filter 'lib/vendor/'
|
|
||||||
add_filter 'doc/'
|
|
||||||
add_filter 'spec/'
|
|
||||||
add_filter 'test/'
|
|
||||||
end
|
|
||||||
1
Library/Homebrew/cask/.simplecov
Symbolic link
1
Library/Homebrew/cask/.simplecov
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../test/.simplecov
|
||||||
@ -1,4 +1,3 @@
|
|||||||
require "coveralls/rake/task"
|
|
||||||
require "rake/testtask"
|
require "rake/testtask"
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "rubocop/rake_task"
|
require "rubocop/rake_task"
|
||||||
@ -20,16 +19,21 @@ namespace :test do
|
|||||||
|
|
||||||
desc "Run tests for minitest and RSpec with coverage"
|
desc "Run tests for minitest and RSpec with coverage"
|
||||||
task :coverage do
|
task :coverage do
|
||||||
ENV["COVERAGE"] = "1"
|
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
|
||||||
|
|
||||||
Rake::Task[:test].invoke
|
Rake::Task[:test].invoke
|
||||||
|
|
||||||
|
if ENV["TRAVIS"]
|
||||||
|
require "coveralls/rake/task"
|
||||||
|
Coveralls::RakeTask.new
|
||||||
|
Rake::Task['coveralls:push'].invoke
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Run tests for minitest and RSpec"
|
desc "Run tests for minitest and RSpec"
|
||||||
task test: ["test:minitest", "test:rspec"]
|
task test: ["test:minitest", "test:rspec"]
|
||||||
|
|
||||||
Coveralls::RakeTask.new
|
|
||||||
|
|
||||||
RuboCop::RakeTask.new(:rubocop) do |t|
|
RuboCop::RakeTask.new(:rubocop) do |t|
|
||||||
t.options = ["--force-exclusion"]
|
t.options = ["--force-exclusion"]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,9 +2,9 @@ require "pathname"
|
|||||||
require "rspec/its"
|
require "rspec/its"
|
||||||
require "rspec/wait"
|
require "rspec/wait"
|
||||||
|
|
||||||
if ENV["COVERAGE"]
|
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||||
require "coveralls"
|
require "simplecov"
|
||||||
Coveralls.wear_merged!
|
SimpleCov.command_name "test:cask:rspec"
|
||||||
end
|
end
|
||||||
|
|
||||||
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
||||||
|
|||||||
@ -2,9 +2,9 @@ require "bundler"
|
|||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
if ENV["COVERAGE"]
|
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||||
require "coveralls"
|
require "simplecov"
|
||||||
Coveralls.wear_merged!
|
SimpleCov.command_name "test:cask:minitest"
|
||||||
end
|
end
|
||||||
|
|
||||||
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
||||||
|
|||||||
@ -659,7 +659,9 @@ module Homebrew
|
|||||||
test "brew", "readall", "--syntax"
|
test "brew", "readall", "--syntax"
|
||||||
if OS.mac?
|
if OS.mac?
|
||||||
run_as_not_developer { test "brew", "tap", "caskroom/cask" }
|
run_as_not_developer { test "brew", "tap", "caskroom/cask" }
|
||||||
test "brew", "cask-tests"
|
tests_args_cask = []
|
||||||
|
tests_args_cask << "--coverage" if ARGV.include?("--coverage")
|
||||||
|
test "brew", "cask-tests", *tests_args_cask
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: try to fix this on Linux at some stage.
|
# TODO: try to fix this on Linux at some stage.
|
||||||
|
|||||||
20
Library/Homebrew/test/.simplecov
Normal file → Executable file
20
Library/Homebrew/test/.simplecov
Normal file → Executable file
@ -1,18 +1,16 @@
|
|||||||
# vim: filetype=ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
SimpleCov.start do
|
SimpleCov.start do
|
||||||
tests_path = File.dirname(__FILE__)
|
coverage_dir File.expand_path("../coverage", File.realpath(__FILE__))
|
||||||
|
root File.expand_path("../..", File.realpath(__FILE__))
|
||||||
minimum_coverage 40 unless ENV["HOMEBREW_TESTS_ONLY"]
|
|
||||||
coverage_dir File.expand_path("#{tests_path}/coverage")
|
|
||||||
root File.expand_path("#{tests_path}/..")
|
|
||||||
|
|
||||||
# We manage the result cache ourselves and the default of 10 minutes can be
|
# We manage the result cache ourselves and the default of 10 minutes can be
|
||||||
# too low (particularly on Travis CI), causing results from some integration
|
# too low (particularly on Travis CI), causing results from some integration
|
||||||
# tests to be dropped. This causes random fluctuations in test coverage.
|
# tests to be dropped. This causes random fluctuations in test coverage.
|
||||||
merge_timeout 86400
|
merge_timeout 86400
|
||||||
|
|
||||||
add_filter "/Homebrew/cask/"
|
add_filter "/Homebrew/cask/spec/"
|
||||||
|
add_filter "/Homebrew/cask/test/"
|
||||||
add_filter "/Homebrew/compat/"
|
add_filter "/Homebrew/compat/"
|
||||||
add_filter "/Homebrew/test/"
|
add_filter "/Homebrew/test/"
|
||||||
add_filter "/Homebrew/vendor/"
|
add_filter "/Homebrew/vendor/"
|
||||||
@ -33,6 +31,7 @@ SimpleCov.start do
|
|||||||
|
|
||||||
# Add groups and the proper project name to the output.
|
# Add groups and the proper project name to the output.
|
||||||
project_name "Homebrew"
|
project_name "Homebrew"
|
||||||
|
add_group "Cask", "/Homebrew/cask/"
|
||||||
add_group "Commands", %w[/Homebrew/cmd/ /Homebrew/dev-cmd/]
|
add_group "Commands", %w[/Homebrew/cmd/ /Homebrew/dev-cmd/]
|
||||||
add_group "Extensions", "/Homebrew/extend/"
|
add_group "Extensions", "/Homebrew/extend/"
|
||||||
add_group "OS", %w[/Homebrew/extend/os/ /Homebrew/os/]
|
add_group "OS", %w[/Homebrew/extend/os/ /Homebrew/os/]
|
||||||
@ -44,10 +43,3 @@ SimpleCov.start do
|
|||||||
/Homebrew/test.rb
|
/Homebrew/test.rb
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Don't use Coveralls outside of CI, as it will override SimpleCov's default
|
|
||||||
# formatter causing the `index.html` not to be written once all tests finish.
|
|
||||||
if RUBY_VERSION.split(".").first.to_i >= 2 && !ENV["HOMEBREW_INTEGRATION_TEST"] && ENV["CI"]
|
|
||||||
require "coveralls"
|
|
||||||
Coveralls.wear!
|
|
||||||
end
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user