Module: Polyrun::RSpec::ShardedFormatterCompat
- Defined in:
- lib/polyrun/rspec/sharded_formatter_compat.rb
Overview
Formatter tweaks for progress formatters under POLYRUN_SHARD_* workers.
Constant Summary collapse
- TextFormatterSilencer =
Module.new do def seed(_notification) end def dump_summary(_notification) end def dump_pending(_notification) end end
- FuubarSeedSilencer =
Module.new do def seed(_notification) end end
Class Method Summary collapse
- .install!(rspec_config: fetch_rspec_configuration!) ) ⇒ Object
- .sharded_worker? ⇒ Boolean
- .silence_fuubar_seed! ⇒ Object
- .silence_text_formatter_noise! ⇒ Object
Class Method Details
.install!(rspec_config: fetch_rspec_configuration!) ) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 23 def install!(rspec_config: fetch_rspec_configuration!) return unless sharded_worker? rspec_config.silence_filter_announcements = true silence_text_formatter_noise! if defined?(Fuubar) end |
.sharded_worker? ⇒ Boolean
31 32 33 |
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 31 def sharded_worker? !ENV["POLYRUN_SHARD_TOTAL"].to_s.strip.empty? end |
.silence_fuubar_seed! ⇒ Object
43 44 45 46 47 48 |
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 43 def return unless defined?(Fuubar) return if Fuubar.ancestors.include?(FuubarSeedSilencer) Fuubar.prepend(FuubarSeedSilencer) end |
.silence_text_formatter_noise! ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 35 def silence_text_formatter_noise! require "rspec/core/formatters/base_text_formatter" klass = ::RSpec::Core::Formatters::BaseTextFormatter return if klass.ancestors.include?(TextFormatterSilencer) klass.prepend(TextFormatterSilencer) end |