lib/qunited/application.rb in qunited-0.3.1 vs lib/qunited/application.rb in qunited-0.4.0
- old
+ new
@@ -1,7 +1,6 @@
require 'optparse'
-require 'ostruct'
module QUnited
class Application
def run
handle_exceptions do
@@ -10,11 +9,12 @@
end
end
def run_tests
js_source_files, js_test_files = ARGV.join(' ').split('--').map { |file_list| file_list.split(' ') }
- exit QUnited::Runner.new(js_source_files, js_test_files, options).run
+ passed = QUnited::Runner.new(js_source_files, js_test_files, options).run
+ exit (passed ? 0 : 10)
end
# Client options generally parsed from the command line
def options
@options ||= {}
@@ -78,24 +78,22 @@
private
def handle_exceptions
begin
yield
- rescue SystemExit
- exit
rescue UsageError => ex
$stderr.puts ex.message
exit 1
rescue OptionParser::InvalidOption => ex
$stderr.puts ex.message
exit 1
- rescue Exception => ex
- display_error_message ex
+ rescue StandardError => ex
+ display_crash_message ex
exit 1
end
end
- def display_error_message(ex)
+ def display_crash_message(ex)
msg = <<MSG
QUnited has aborted! If this is unexpected, you may want to open an issue at
github.com/aaronroyer/qunited to get a possible bug fixed. If you do, please
include the debug information below.
MSG