A platform for community discussion. Free, open, simple.
DEV: Print proper summary when errors have been reporter in turbo_rspec
Guo Xiang Tan1157d2a0ff41
diff --git a/lib/turbo_tests/json_rows_formatter.rb b/lib/turbo_tests/json_rows_formatter.rbindex c83ee32ce72..453edd42649 100644--- a/lib/turbo_tests/json_rows_formatter.rb+++ b/lib/turbo_tests/json_rows_formatter.rb@@ -9,6 +9,7 @@ module TurboTests:example_failed,:example_passed,:example_pending,+ :message,:seed)@@ -95,6 +96,13 @@ module TurboTests)end+ def message(notification)+ output_row(+ type: :message,+ message: notification.message+ )+ end+privatedef output_row(obj)diff --git a/lib/turbo_tests/reporter.rb b/lib/turbo_tests/reporter.rbindex 62a3db2e48d..6d02a1fb588 100644--- a/lib/turbo_tests/reporter.rb+++ b/lib/turbo_tests/reporter.rb@@ -27,6 +27,8 @@ module TurboTests@failed_examples = []@all_examples = []@start_time = start_time+ @messages = []+ @errors_outside_of_examples_count = 0enddef add(name, outputs)@@ -63,6 +65,15 @@ module TurboTests@failed_examples << exampleend+ def message(message)+ delegate_to_formatters(:message, RSpec::Core::Notifications::MessageNotification.new(message))+ @messages << message+ end++ def error_outside_of_examples+ @errors_outside_of_examples_count += 1+ end+def finishend_time = Time.now@@ -86,7 +97,7 @@ module TurboTests@failed_examples,@pending_examples,0,- 0+ @errors_outside_of_examples_count))delegate_to_formatters(:close,diff --git a/lib/turbo_tests/runner.rb b/lib/turbo_tests/runner.rbindex c0e90536643..3faff70dc35 100644--- a/lib/turbo_tests/runner.rb+++ b/lib/turbo_tests/runner.rb@@ -44,7 +44,6 @@ module TurboTestsgroup_opts = {}if use_runtime_info- FileUtils.rm("tmp/turbo_rspec_runtime.log", force: true)group_opts[:runtime_log] = "tmp/turbo_rspec_runtime.log"elsegroup_opts[:group_by] = :filesize@@ -189,14 +188,12 @@ module TurboTests@messages << { type: 'exit', process_id: process_id }end- stdout_thread = start_copy_thread(stdout, STDOUT)- stderr_thread = start_copy_thread(stderr, STDERR)- @threads << stdout_thread- @threads << stderr_thread+ @threads << start_copy_thread(stdout, STDOUT)+ @threads << start_copy_thread(stderr, STDERR)@threads << Thread.new doif wait_thr.value.exitstatus != 0- @messages << { type: 'error', record_runtime: record_runtime }+ @messages << { type: 'error' }endendend@@ -238,15 +235,13 @@ module TurboTests@threads.each(&:kill)breakend+ when 'message'+ @reporter.message(message[:message])when 'seed'when 'close'when 'error'- if message[:record_runtime]- STDERR.puts File.read("tmp/turbo_rspec_runtime.log")- end- @threads.each(&:kill)+ @reporter.error_outside_of_examples@error = true- breakwhen 'exit'exited += 1if exited == @num_processes + 1