brew/Library/Homebrew/cask/cmd/brew-cask-tests.rb

42 lines
1.1 KiB
Ruby
Raw Normal View History

2016-08-18 22:11:42 +03:00
require "English"
2016-09-20 00:02:04 +01:00
def run_tests(executable, files, args = [])
opts = []
opts << "--serialize-stdout" if ENV["CI"]
system "bundle", "exec", executable, *opts, "--", *args, "--", *files
2016-09-20 00:02:04 +01:00
end
2016-08-18 22:11:42 +03:00
repo_root = Pathname(__FILE__).realpath.parent.parent
repo_root.cd do
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
Homebrew.install_gem_setup_path! "bundler"
unless quiet_system("bundle", "check")
system "bundle", "install", "--path", "vendor/bundle"
end
2016-09-20 00:02:04 +01:00
rspec = ARGV.flag?("--rspec") || !ARGV.flag?("--minitest")
minitest = ARGV.flag?("--minitest") || !ARGV.flag?("--rspec")
ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag?("--coverage")
2016-09-20 13:16:11 +01:00
if rspec
run_tests "parallel_rspec", Dir["spec/**/*_spec.rb"], %w[
--format progress
--format ParallelTests::RSpec::RuntimeLogger
--out tmp/parallel_runtime_rspec.log
]
end
if minitest
run_tests "parallel_test", Dir["test/**/*_test.rb"]
end
2016-09-20 00:02:04 +01:00
if ENV["CODECOV_TOKEN"]
2016-09-20 16:39:16 +01:00
system "bundle", "exec", "rake", "test:coverage:upload"
2016-08-18 22:11:42 +03:00
end
Homebrew.failed = !$CHILD_STATUS.success?
end