Skip to content

Commit 0df1298

Browse files
Add a test:server rake task.
For IE, I find it far easier to start the test server on my dev machine, then use my IE machine to visit the test pages manually. For that I need a task that runs the server indefinitely. At some point I'll add a page that does nothing but list the tests for convenience.
1 parent 84a4d4f commit 0df1298

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Rakefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,32 @@ namespace :test do
305305
task :require do
306306
PrototypeHelper.require_unittest_js
307307
end
308+
309+
desc "Builds all the unit tests and starts the server. (The user can visit the tests manually in a browser at their leisure.)"
310+
task :server => [:build] do
311+
runner = UnittestJS::WEBrickRunner::Runner.new(:test_dir => PrototypeHelper::TMP_DIR)
312+
testcases = ENV['TESTCASES']
313+
314+
Dir[File.join(PrototypeHelper::TMP_DIR, '*_test.html')].each do |file|
315+
file = File.basename(file)
316+
test = file.sub('_test.html', '')
317+
runner.add_test(file, testcases)
318+
end
319+
320+
trap('INT') do
321+
puts "...server stopped."
322+
runner.teardown
323+
exit
324+
end
325+
326+
puts "Server started..."
327+
328+
runner.setup
329+
330+
loop do
331+
sleep 1
332+
end
333+
end
308334
end
309335

310336
task :test_units do

0 commit comments

Comments
 (0)