DEV: Restore RSpec 'documentation' output, but collapse in CI (#26485)

This reverts commit ef895f1c32ad406a37a10137eab38d75bc82bd38 and 57df0d526e2d131d80c878edee27c8b3a0fccfe4, but adds GitHub actions line grouping to the verbose output to reduce scrolling.
This commit is contained in:
David Taylor
2024-04-03 10:54:55 +01:00
committed by GitHub
parent c5f1fc3a08
commit 8098876bfa
4 changed files with 30 additions and 7 deletions

View File

@ -3,7 +3,22 @@
module TurboTests
# An RSpec formatter that prepends the process id to all messages
class 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"]
end
def example_passed(notification)
output.puts RSpec::Core::Formatters::ConsoleCodes.wrap(

View File

@ -48,6 +48,10 @@ module TurboTests
end
end
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 TurboTests
def finish
end_time = Time.now
delegate_to_formatters(:stop, RSpec::Core::Notifications::NullNotification)
delegate_to_formatters(:start_dump, RSpec::Core::Notifications::NullNotification)
delegate_to_formatters(

View File

@ -89,6 +89,8 @@ module TurboTests
start_regular_subprocess(tests, process_id + 1, **subprocess_opts)
end
@reporter.start
handle_messages
@reporter.finish