-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
37 lines (30 loc) · 1.01 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["CI"]
require "appraisal/task"
Appraisal::Task.new
task default: :appraisal
else
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
# Running specific tests with line numbers, like with rails test, is not supported by default in rake.
# By setting the TESTOPS env var we can however specify the name of a single test with underscores instead of spaces.
# So run your single test by calling for ex:
#
# rake test /Users/sebastian/projects/cheddar/rails-twirp/test/ping_controller_test.rb "uncaught errors should bubble up to the test"
file_name = ARGV[1]
test_name = ARGV[2]&.tr(" ", "_")
ENV["TESTOPTS"] = "--verbose"
t.test_files = if file_name
if test_name
ENV["TESTOPTS"] += " --name=test_#{test_name}"
end
[file_name]
else
FileList["test/**/*_test.rb"]
end
end
task default: :test
end