A platform for community discussion. Free, open, simple.
DEV: Restore RSpec 'documentation' output, but collapse in CI (#26485)
David Taylor8098876bfaf2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 930b7b9d4a4..5ec6e5c7ba5 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -212,11 +212,11 @@ jobs:- name: Core RSpecif: matrix.build_type == 'backend' && matrix.target == 'core'- run: bin/turbo_rspec --use-runtime-info --verbose+ run: bin/turbo_rspec --use-runtime-info --verbose --format documentation- name: Plugin RSpecif: matrix.build_type == 'backend' && matrix.target == 'plugins'- run: bin/rake plugin:turbo_spec['*','--verbose --use-runtime-info']+ run: bin/rake plugin:turbo_spec['*','--verbose --format documentation --use-runtime-info']- name: Plugin QUnitif: matrix.build_type == 'frontend' && matrix.target == 'plugins'@@ -246,7 +246,7 @@ jobs:if: matrix.build_type == 'system' && matrix.target == 'core'env:CHECKOUT_TIMEOUT: 10- run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose spec/system+ run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation spec/system- name: Plugin System Testsif: matrix.build_type == 'system' && matrix.target == 'plugins'@@ -254,7 +254,7 @@ jobs:CHECKOUT_TIMEOUT: 10run: |GLOBIGNORE="plugins/chat/*";- LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose plugins/*/spec/system+ LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/systemshell: bashtimeout-minutes: 30@@ -262,7 +262,7 @@ jobs:if: matrix.build_type == 'system' && matrix.target == 'chat'env:CHECKOUT_TIMEOUT: 10- run: LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose plugins/chat/spec/system+ run: LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/chat/spec/systemtimeout-minutes: 30- name: Theme System Tests@@ -270,7 +270,7 @@ jobs:env:CHECKOUT_TIMEOUT: 10run: |- RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --profile=50 --verbose tmp/themes/*/spec/system+ RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/systemshell: bashtimeout-minutes: 30diff --git a/lib/turbo_tests/documentation_formatter.rb b/lib/turbo_tests/documentation_formatter.rbindex 10d9b5630c3..a9ded17108e 100644--- a/lib/turbo_tests/documentation_formatter.rb+++ b/lib/turbo_tests/documentation_formatter.rb@@ -3,7 +3,22 @@module TurboTests# An RSpec formatter that prepends the process id to all messagesclass DocumentationFormatter < ::TurboTests::BaseFormatter- RSpec::Core::Formatters.register(self, :example_failed, :example_passed, :example_pending)+ RSpec::Core::Formatters.register(+ self,+ :example_failed,+ :example_passed,+ :example_pending,+ :start,+ :stop,+ )++ def start(*args)+ output.puts "::group:: Verbose turbo_spec output" if ENV["GITHUB_ACTIONS"]+ end++ def stop(*args)+ output.puts "::endgroup::" if ENV["GITHUB_ACTIONS"]+ enddef example_passed(notification)output.puts RSpec::Core::Formatters::ConsoleCodes.wrap(diff --git a/lib/turbo_tests/reporter.rb b/lib/turbo_tests/reporter.rbindex e58630b78a2..5204ff0e0ce 100644--- a/lib/turbo_tests/reporter.rb+++ b/lib/turbo_tests/reporter.rb@@ -48,6 +48,10 @@ module TurboTestsendend+ def start+ delegate_to_formatters(:start, RSpec::Core::Notifications::NullNotification)+ end+def example_passed(example)delegate_to_formatters(:example_passed, example.notification)@@ -83,6 +87,8 @@ module TurboTestsdef finishend_time = Time.now+ delegate_to_formatters(:stop, RSpec::Core::Notifications::NullNotification)+delegate_to_formatters(:start_dump, RSpec::Core::Notifications::NullNotification)delegate_to_formatters(diff --git a/lib/turbo_tests/runner.rb b/lib/turbo_tests/runner.rbindex b4de43eed84..29485156c15 100644--- a/lib/turbo_tests/runner.rb+++ b/lib/turbo_tests/runner.rb@@ -89,6 +89,8 @@ module TurboTestsstart_regular_subprocess(tests, process_id + 1, **subprocess_opts)end+ @reporter.start+handle_messages@reporter.finish