-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
48 lines (40 loc) · 1.41 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
require 'bundler/gem_tasks'
require 'rake/testtask'
def run_command_in_test_apps(command)
test_apps_pattern = 'test/test_apps/[0-9]*'
Dir.glob(test_apps_pattern).each do |test_app_directory|
gemfile_path = File.expand_path("../#{test_app_directory}/Gemfile", __FILE__)
test_app_path = File.expand_path("../#{test_app_directory}", __FILE__)
specific_gemfile_env = Bundler.clean_env
specific_gemfile_env['BUNDLE_GEMFILE'] = gemfile_path
puts '---------------------',
"Gemfile: #{gemfile_path}",
"Directory: #{test_app_path}",
"Command: '#{command}'",
'---------------------'
Bundler.send(:with_env, specific_gemfile_env) do
exit_status_was_zero = system("cd #{test_app_path} && #{command}")
raise unless exit_status_was_zero
end
end
end
namespace :test do
desc 'Run unit tests'
Rake::TestTask.new(:units) do |t|
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/sprockets/bumble_d/**/*_test.rb']
end
desc 'Run integration tests on all test apps'
task :integration do
run_command_in_test_apps('bundle exec rake test')
end
namespace :integration do
desc 'Resolve and install dependencies for all test apps'
task :install do
run_command_in_test_apps('bundle check || bundle install')
run_command_in_test_apps('npm install')
end
end
end
task default: ['test:units', 'test:integration']