-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
87 lines (74 loc) · 2.24 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
task :default
TESTOPTS = ENV.delete("TESTOPTS") || ""
RUBOCOP_REQUIRED = (ENV["RUBOCOP"] == "1")
USE_RUBOCOP = (ENV["RUBOCOP"] != "0")
USE_JUNIT = (ENV["JUNIT"] == "1")
REPORT_DIR = ENV["REPORT_DIR"] || File.expand_path("test_reports", __dir__)
def minitest_set_options(test_task, name)
minitest_options = []
if USE_JUNIT
minitest_options += [
"--junit", "--junit-jenkins",
"--junit-filename=#{REPORT_DIR}/#{name}.junit.xml"
]
end
minitest_args =
if minitest_options.empty?
""
else
"\"" + minitest_options.join("\" \"") + "\""
end
test_task.options = "#{TESTOPTS} #{minitest_args} -- --simplecov-name=#{name}"
end
Rake::TestTask.new("test:core") do |t|
t.libs << "."
t.libs << "lib"
minitest_set_options(t, "core")
test_files = FileList["test/**/test_*.rb"]
test_files = test_files
.exclude("test/ros/**/*.rb")
.exclude("test/gui/**/*.rb")
.exclude("test/live/**/*.rb")
t.test_files = test_files
t.warning = false
end
task "test:live" do
tests = Dir.enum_for(:glob, "test/live/test_*.rb").to_a
unless system(File.join("test", "live", "run"), *tests)
$stderr.puts "live tests failed"
exit 1
end
end
Rake::TestTask.new("test:gui") do |t|
t.libs << "."
t.libs << "lib"
minitest_set_options(t, "gui")
t.test_files = FileList["test/gui/**/test_*.rb"]
t.warning = false
end
task "test" => ["test:gui", "test:core", "test:live"]
if USE_RUBOCOP
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new do |t|
if USE_JUNIT
t.formatters << "junit"
t.options << "-o" << "#{REPORT_DIR}/rubocop.junit.xml"
end
end
task "test" => "rubocop"
rescue LoadError
raise if RUBOCOP_REQUIRED
end
end
begin
require "coveralls/rake/task"
Coveralls::RakeTask.new
task "test:coveralls" => ["test", "coveralls:push"]
rescue LoadError # rubocop:disable Lint/SuppressedException
end
# For backward compatibility with some scripts that expected hoe
task "gem" => "build"