Class: TurboTests::JsonRowsFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_tests/json_rows_formatter.rb

Overview

An RSpec formatter used for each subprocess during parallel test execution

Constant Summary collapse

INTERNAL_BACKTRACE_PATTERNS =
[
  %r{/bin/turbo_tests2\b},
  %r{/exe/turbo_tests2\b},
  %r{/lib/turbo_tests(?:\.rb|/)}
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ JsonRowsFormatter

Returns a new instance of JsonRowsFormatter.



46
47
48
# File 'lib/turbo_tests/json_rows_formatter.rb', line 46

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



44
45
46
# File 'lib/turbo_tests/json_rows_formatter.rb', line 44

def output
  @output
end

Instance Method Details

#close(_notification) ⇒ Object



99
100
101
102
103
# File 'lib/turbo_tests/json_rows_formatter.rb', line 99

def close(_notification)
  output_row(
    type: :close
  )
end

#deprecation(notification) ⇒ Object



112
113
114
115
116
117
# File 'lib/turbo_tests/json_rows_formatter.rb', line 112

def deprecation(notification)
  output_row(
    type: :deprecation,
    deprecation: deprecation_to_json(notification)
  )
end

#dump_profile(notification) ⇒ Object



119
120
121
122
123
124
# File 'lib/turbo_tests/json_rows_formatter.rb', line 119

def dump_profile(notification)
  output_row(
    type: :profile,
    profile: profile_to_json(notification)
  )
end

#example_failed(notification) ⇒ Object



85
86
87
88
89
90
# File 'lib/turbo_tests/json_rows_formatter.rb', line 85

def example_failed(notification)
  output_row(
    type: :example_failed,
    example: example_to_json(notification.example)
  )
end

#example_group_finished(notification) ⇒ Object



64
65
66
67
68
69
# File 'lib/turbo_tests/json_rows_formatter.rb', line 64

def example_group_finished(notification)
  output_row(
    type: :group_finished,
    group: group_to_json(notification)
  )
end

#example_group_started(notification) ⇒ Object



57
58
59
60
61
62
# File 'lib/turbo_tests/json_rows_formatter.rb', line 57

def example_group_started(notification)
  output_row(
    type: :group_started,
    group: group_to_json(notification)
  )
end

#example_passed(notification) ⇒ Object



71
72
73
74
75
76
# File 'lib/turbo_tests/json_rows_formatter.rb', line 71

def example_passed(notification)
  output_row(
    type: :example_passed,
    example: example_to_json(notification.example)
  )
end

#example_pending(notification) ⇒ Object



78
79
80
81
82
83
# File 'lib/turbo_tests/json_rows_formatter.rb', line 78

def example_pending(notification)
  output_row(
    type: :example_pending,
    example: example_to_json(notification.example)
  )
end

#message(notification) ⇒ Object



105
106
107
108
109
110
# File 'lib/turbo_tests/json_rows_formatter.rb', line 105

def message(notification)
  output_row(
    type: :message,
    message: notification.message
  )
end

#seed(notification) ⇒ Object



92
93
94
95
96
97
# File 'lib/turbo_tests/json_rows_formatter.rb', line 92

def seed(notification)
  output_row(
    type: :seed,
    seed: notification.seed
  )
end

#start(notification) ⇒ Object



50
51
52
53
54
55
# File 'lib/turbo_tests/json_rows_formatter.rb', line 50

def start(notification)
  output_row(
    type: :load_summary,
    summary: load_summary_to_json(notification)
  )
end