Module: Tryouts::CLI::FormatterInterface

Included in:
AgentFormatter, CompactFormatter, QuietFormatter, VerboseFormatter
Defined in:
lib/tryouts/cli/formatters/base.rb

Overview

Enhanced interface for all test output formatting

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_indentObject (readonly)

Returns the value of attribute current_indent.



9
10
11
# File 'lib/tryouts/cli/formatters/base.rb', line 9

def current_indent
  @current_indent
end

#stderrObject (readonly)

Returns the value of attribute stderr.



9
10
11
# File 'lib/tryouts/cli/formatters/base.rb', line 9

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



9
10
11
# File 'lib/tryouts/cli/formatters/base.rb', line 9

def stdout
  @stdout
end

Instance Method Details

#batch_summary(failure_collector) ⇒ Object

Summary operations



83
84
85
# File 'lib/tryouts/cli/formatters/base.rb', line 83

def batch_summary(failure_collector)
  # Default: no output
end

#debug_info(message, level: 0) ⇒ Object

Debug and diagnostic output



92
93
94
# File 'lib/tryouts/cli/formatters/base.rb', line 92

def debug_info(message, level: 0)
  # Default: no output
end

#error_message(message, backtrace: nil) ⇒ Object



100
101
102
# File 'lib/tryouts/cli/formatters/base.rb', line 100

def error_message(message, backtrace: nil)
  # Default: no output
end

#file_end(file_path, context_info: {}) ⇒ Object



28
29
30
# File 'lib/tryouts/cli/formatters/base.rb', line 28

def file_end(file_path, context_info: {})
  # Default: no output
end

#file_execution_start(file_path, test_count:, context_mode:) ⇒ Object



40
41
42
# File 'lib/tryouts/cli/formatters/base.rb', line 40

def file_execution_start(file_path, test_count:, context_mode:)
  # Default: no output
end

#file_parsed(file_path, test_count:, setup_present: false, teardown_present: false) ⇒ Object



32
33
34
# File 'lib/tryouts/cli/formatters/base.rb', line 32

def file_parsed(file_path, test_count:, setup_present: false, teardown_present: false)
  # Default: no output
end

#file_result(file_path, total_tests:, failed_count:, error_count:, elapsed_time: nil) ⇒ Object



44
45
46
# File 'lib/tryouts/cli/formatters/base.rb', line 44

def file_result(file_path, total_tests:, failed_count:, error_count:, elapsed_time: nil)
  # Default: no output
end

#file_start(file_path, context_info: {}) ⇒ Object

File-level operations



24
25
26
# File 'lib/tryouts/cli/formatters/base.rb', line 24

def file_start(file_path, context_info: {})
  # Default: no output
end

#grand_total(total_tests:, failed_count:, error_count:, successful_files:, total_files:, elapsed_time:) ⇒ Object



87
88
89
# File 'lib/tryouts/cli/formatters/base.rb', line 87

def grand_total(total_tests:, failed_count:, error_count:, successful_files:, total_files:, elapsed_time:)
  # Default: no output
end

#initialize(options = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/tryouts/cli/formatters/base.rb', line 11

def initialize(options = {})
  @stdout = options.fetch(:stdout, $stdout)
  @stderr = options.fetch(:stderr, $stderr)
  @current_indent = 0
  @options = options
end

#live_status_capabilitiesObject

Live status capability negotiation



105
106
107
108
109
110
111
# File 'lib/tryouts/cli/formatters/base.rb', line 105

def live_status_capabilities
  {
    supports_coordination: false,    # Can work with coordinated output
    output_frequency: :medium,       # :low, :medium, :high
    requires_tty: false,             # Must have TTY to function
  }
end

#live_status_managerObject



118
119
120
# File 'lib/tryouts/cli/formatters/base.rb', line 118

def live_status_manager
  @live_status_manager
end

#parser_warnings(file_path, warnings:) ⇒ Object



36
37
38
# File 'lib/tryouts/cli/formatters/base.rb', line 36

def parser_warnings(file_path, warnings:)
  # Default: no output - override in specific formatters
end

#phase_header(message, file_count: nil) ⇒ Object

Phase-level output (major sections)



19
20
21
# File 'lib/tryouts/cli/formatters/base.rb', line 19

def phase_header(message, file_count: nil)
  # Default: no output
end

#puts(text = '') ⇒ Object



131
132
133
# File 'lib/tryouts/cli/formatters/base.rb', line 131

def puts(text = '')
  write("#{text}\n")
end

#set_live_status_manager(manager) ⇒ Object

Live status integration (optional methods)



114
115
116
# File 'lib/tryouts/cli/formatters/base.rb', line 114

def set_live_status_manager(manager)
  @live_status_manager = manager
end

#setup_output(output_text) ⇒ Object



70
71
72
# File 'lib/tryouts/cli/formatters/base.rb', line 70

def setup_output(output_text)
  # Default: no output
end

#setup_start(line_range:) ⇒ Object

Setup/teardown operations



66
67
68
# File 'lib/tryouts/cli/formatters/base.rb', line 66

def setup_start(line_range:)
  # Default: no output
end

#teardown_output(output_text) ⇒ Object



78
79
80
# File 'lib/tryouts/cli/formatters/base.rb', line 78

def teardown_output(output_text)
  # Default: no output
end

#teardown_start(line_range:) ⇒ Object



74
75
76
# File 'lib/tryouts/cli/formatters/base.rb', line 74

def teardown_start(line_range:)
  # Default: no output
end

#test_end(test_case:, index:, total:) ⇒ Object



53
54
55
# File 'lib/tryouts/cli/formatters/base.rb', line 53

def test_end(test_case:, index:, total:)
  # Default: no output
end

#test_output(test_case:, output_text:, result_packet:) ⇒ Object



61
62
63
# File 'lib/tryouts/cli/formatters/base.rb', line 61

def test_output(test_case:, output_text:, result_packet:)
  # Default: no output
end

#test_result(result_packet) ⇒ Object



57
58
59
# File 'lib/tryouts/cli/formatters/base.rb', line 57

def test_result(result_packet)
  # Default: no output
end

#test_start(test_case:, index:, total:) ⇒ Object

Test-level operations



49
50
51
# File 'lib/tryouts/cli/formatters/base.rb', line 49

def test_start(test_case:, index:, total:)
  # Default: no output
end

#trace_info(message, level: 0) ⇒ Object



96
97
98
# File 'lib/tryouts/cli/formatters/base.rb', line 96

def trace_info(message, level: 0)
  # Default: no output
end

#update_live_status(state_updates = {}) ⇒ Object

Optional: formatters can implement this to provide custom live status updates



136
137
138
# File 'lib/tryouts/cli/formatters/base.rb', line 136

def update_live_status(state_updates = {})
  @live_status_manager&.update_status(state_updates)
end

#write(text) ⇒ Object

Standard output methods that coordinate with live status automatically



123
124
125
126
127
128
129
# File 'lib/tryouts/cli/formatters/base.rb', line 123

def write(text)
  if @live_status_manager&.enabled?
    @live_status_manager.write_string(text)
  else
    @stdout.print(text)
  end
end