@@ -47,7 +47,10 @@ task :mspec_node do
47
47
end
48
48
49
49
requires = specs . map { |s | "require '#{ s . sub ( /^spec\/ / , '' ) } '" }
50
+ include_paths = '-Ispec -Ilib'
51
+
50
52
filename = 'tmp/mspec_node.rb'
53
+ js_filename = 'tmp/mspec_node.js'
51
54
mkdir_p File . dirname ( filename )
52
55
enter_benchmarking_mode = ENV [ 'BM' ] && "OSpecRunner.main.bm!(#{ Integer ( ENV [ 'BM' ] ) } )"
53
56
File . write filename , <<-RUBY
@@ -59,7 +62,9 @@ task :mspec_node do
59
62
60
63
stubs = '-smspec/helpers/tmp -smspec/helpers/environment -smspec/guards/block_device -smspec/guards/endian'
61
64
62
- sh "ruby -rbundler/setup -rmspec/opal/special_calls bin/opal -Ispec -Ilib -gmspec #{ stubs } -rnodejs -Dwarning -A #{ filename } "
65
+ sh "ruby -rbundler/setup -rmspec/opal/special_calls " \
66
+ "bin/opal -gmspec #{ include_paths } #{ stubs } -rnodejs -Dwarning -A #{ filename } -c > #{ js_filename } "
67
+ sh "NODE_PATH=stdlib/nodejs/node_modules node #{ js_filename } "
63
68
end
64
69
65
70
task :cruby_tests do
@@ -85,16 +90,17 @@ task :cruby_tests do
85
90
86
91
requires = files . map { |f | "require '#{ f } '" }
87
92
filename = 'tmp/cruby_tests.rb'
93
+ js_filename = 'tmp/cruby_tests.js'
88
94
mkdir_p File . dirname ( filename )
89
95
File . write filename , requires . join ( "\n " )
90
96
91
97
stubs = "-soptparse -sio/console -stimeout -smutex_m -srubygems -stempfile -smonitor"
92
98
93
99
puts "== Running: #{ files . join ", " } "
94
100
95
- sh 'RUBYOPT=" -rbundler/setup" ' \
96
- "bin/opal #{ include_paths } #{ stubs } -rnodejs -Dwarning -A #{ filename } -c > tmp/cruby_tests.js "
97
- sh ' NODE_PATH=stdlib/nodejs/node_modules node tmp/cruby_tests.js'
101
+ sh "ruby -rbundler/setup " \
102
+ "bin/opal #{ include_paths } #{ stubs } -rnodejs -Dwarning -A #{ filename } -c > #{ js_filename } "
103
+ sh " NODE_PATH=stdlib/nodejs/node_modules node #{ js_filename } "
98
104
end
99
105
100
106
task :mspec => [ :mspec_node , :mspec_phantom ]
0 commit comments