7
7
module RSpec
8
8
module TAP
9
9
module Formatters
10
+ # Compact TAP formatter
10
11
class Compact < RSpec ::Core ::Formatters ::BaseFormatter
12
+ # List of subscribed notifications
11
13
NOTIFICATIONS = %i[
12
14
seed
13
15
start
@@ -36,27 +38,40 @@ def initialize(output)
36
38
@example_number = 0
37
39
end
38
40
41
+ # Seed notification
42
+ #
43
+ # @param notification [SeedNotification]
39
44
def seed ( notification )
40
45
@seed = notification . seed if notification . seed_used?
41
46
end
42
47
48
+ # Start notification
49
+ #
50
+ # @param notification [StartNotification]
43
51
def start ( notification )
44
52
super
45
53
46
54
@printer . start_output
47
55
end
48
56
57
+ # Execution finished notification
49
58
def start_dump ( _notification )
50
59
@printer . example_progress_dump
51
60
end
52
61
62
+ # Example group start notification
63
+ #
64
+ # @param notification [GroupNotification]
53
65
def example_group_started ( notification )
54
66
@printer . group_start_output ( notification , @level )
55
67
56
68
@level += 1
57
69
@example_number = 0
58
70
end
59
71
72
+ # Example group finish notification
73
+ #
74
+ # @param notification [GroupNotification]
60
75
def example_group_finished ( notification )
61
76
@printer . group_finished_output (
62
77
@test_stats . data [ notification . group . metadata [ :line_number ] ] ,
@@ -67,10 +82,14 @@ def example_group_finished(notification)
67
82
@test_stats = TestStats . new if @level . zero?
68
83
end
69
84
85
+ # Example start notification
70
86
def example_started ( _notification )
71
87
@example_number += 1
72
88
end
73
89
90
+ # Passing example notification
91
+ #
92
+ # @param notification [ExampleNotification]
74
93
def example_passed ( notification )
75
94
@test_stats . populate ( notification , 1 )
76
95
@printer . example_progress_output ( :success )
@@ -81,6 +100,9 @@ def example_passed(notification)
81
100
)
82
101
end
83
102
103
+ # Failing example notification
104
+ #
105
+ # @param notification [FailedExampleNotification]
84
106
def example_failed ( notification )
85
107
@test_stats . populate ( notification , 2 )
86
108
@printer . example_progress_output ( :failure )
@@ -91,6 +113,10 @@ def example_failed(notification)
91
113
)
92
114
end
93
115
116
+ # Pending example notification
117
+ #
118
+ # @param notification [PendingExampleFailedAsExpectedNotification
119
+ # , SkippedExampleException]
94
120
def example_pending ( notification )
95
121
@test_stats . populate ( notification , 3 )
96
122
@printer . example_progress_output ( :pending )
@@ -102,18 +128,30 @@ def example_pending(notification)
102
128
)
103
129
end
104
130
131
+ # Failure outside of example notification
132
+ #
133
+ # @param notification [MessageNotification]
105
134
def message ( notification )
106
135
@printer . message_output ( notification )
107
136
end
108
137
138
+ # Failure examples notification
139
+ #
140
+ # @param notification [ExamplesNotification]
109
141
def dump_failures ( notification )
110
142
@printer . store_failed_examples_summary ( notification )
111
143
end
112
144
145
+ # Pending examples notification
146
+ #
147
+ # @param notification [ExamplesNotification]
113
148
def dump_pending ( notification )
114
149
@printer . store_pending_examples_summary ( notification )
115
150
end
116
151
152
+ # Examples summary notification
153
+ #
154
+ # @param notification [SummaryNotification]
117
155
def dump_summary ( notification )
118
156
@printer . summary_output ( notification , @seed )
119
157
end
0 commit comments