
OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
52 lines
1.3 KiB
Ruby
52 lines
1.3 KiB
Ruby
require "rake/testtask"
|
|
require "rspec/core/rake_task"
|
|
require "rubocop/rake_task"
|
|
|
|
homebrew_repo = `brew --repository`.chomp
|
|
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
|
|
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
|
|
|
namespace :test do
|
|
Rake::TestTask.new(:minitest) do |t|
|
|
# TODO: setting the --seed here is an ugly temporary hack, to remain only
|
|
# until test-suite glitches are fixed.
|
|
ENV["TESTOPTS"] = "--seed=14830" if ENV["TRAVIS"]
|
|
t.pattern = "test/**/*_test.rb"
|
|
t.libs << "test"
|
|
end
|
|
|
|
RSpec::Core::RakeTask.new(:rspec)
|
|
|
|
desc "Run tests for minitest and RSpec with coverage"
|
|
task :coverage do
|
|
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
|
|
|
|
Rake::Task[:test].invoke
|
|
|
|
if ENV["CODECOV_TOKEN"]
|
|
require "simplecov"
|
|
require "codecov"
|
|
formatter = SimpleCov::Formatter::Codecov.new
|
|
formatter.format(SimpleCov::ResultMerger.merged_result)
|
|
end
|
|
end
|
|
end
|
|
|
|
desc "Run tests for minitest and RSpec"
|
|
task test: ["test:minitest", "test:rspec"]
|
|
|
|
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
t.options = ["--force-exclusion"]
|
|
end
|
|
|
|
task default: [:test, :rubocop]
|
|
|
|
desc "Open a REPL for debugging and experimentation"
|
|
task :console do
|
|
require "pry"
|
|
require "pry-byebug"
|
|
require "hbc"
|
|
ARGV.clear
|
|
Hbc.pry
|
|
end
|