@@ -11,19 +11,43 @@ task test: "test:isolated"
1111
1212namespace :test do
1313 task :isolated do
14+ dash_i = [
15+ "test" ,
16+ "lib" ,
17+ "../activesupport/lib" ,
18+ "../actionpack/lib" ,
19+ "../actionview/lib" ,
20+ "../activemodel/lib"
21+ ] . map { |dir | File . expand_path ( dir , __dir__ ) }
22+
23+ dash_i . reverse_each do |x |
24+ $:. unshift ( x ) unless $:. include? ( x )
25+ end
26+ $-w = true
27+
28+ require "bundler/setup" unless defined? ( Bundler )
29+ require "active_support"
30+
1431 dirs = ( ENV [ "TEST_DIR" ] || ENV [ "TEST_DIRS" ] || "**" ) . split ( "," )
1532 test_files = dirs . map { |dir | "test/#{ dir } /*_test.rb" }
1633 Dir [ *test_files ] . each do |file |
17- next true if file . include? ( "fixtures" )
18- dash_i = [
19- "test" ,
20- "lib" ,
21- "#{ __dir__ } /../activesupport/lib" ,
22- "#{ __dir__ } /../actionpack/lib" ,
23- "#{ __dir__ } /../actionview/lib" ,
24- "#{ __dir__ } /../activemodel/lib"
25- ]
26- ruby "-w" , "-I#{ dash_i . join ':' } " , file
34+ next true if file . start_with? ( "test/fixtures/" )
35+
36+ fake_command = Shellwords . join ( [
37+ FileUtils ::RUBY ,
38+ "-w" ,
39+ *dash_i . map { |dir | "-I#{ Pathname . new ( dir ) . relative_path_from ( Pathname . pwd ) } " } ,
40+ file ,
41+ ] )
42+ puts fake_command
43+
44+ # We could run these in parallel, but pretty much all of the
45+ # railties tests already run in parallel, so ¯\_(⊙︿⊙)_/¯
46+ Process . waitpid fork { ARGV . clear ; load file }
47+
48+ unless $?. success?
49+ raise "Command failed with status (#{ $?. exitstatus } ): #{ fake_command } "
50+ end
2751 end
2852 end
2953end
0 commit comments