Skip to content

Commit 67c6dd7

Browse files
Log files that have 100% coverage when printing partial summary.
1 parent 7a2e500 commit 67c6dd7

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

lib/covered/summary.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,50 @@ def print_coverage(terminal, coverage, before: 4, after: 4)
194194
end
195195
end
196196
end
197+
198+
def call(wrapper, output = $stdout, **options)
199+
terminal = self.terminal(output)
200+
complete_files = []
201+
202+
statistics = self.each(wrapper) do |coverage|
203+
path = wrapper.relative_path(coverage.path)
204+
terminal.puts ""
205+
terminal.puts path, style: :path
206+
207+
begin
208+
print_coverage(terminal, coverage, **options)
209+
rescue => error
210+
print_error(terminal, error)
211+
end
212+
213+
coverage.print(output)
214+
end
215+
216+
# Collect files with 100% coverage that were not shown
217+
wrapper.each do |coverage|
218+
if coverage.ratio >= 1.0
219+
complete_files << wrapper.relative_path(coverage.path)
220+
end
221+
end
222+
223+
terminal.puts
224+
statistics.print(output)
225+
226+
# Show information about files with 100% coverage
227+
if complete_files.any?
228+
terminal.puts ""
229+
if complete_files.size == 1
230+
terminal.puts "1 file has 100% coverage and is not shown above:"
231+
else
232+
terminal.puts "#{complete_files.size} files have 100% coverage and are not shown above:"
233+
end
234+
235+
complete_files.sort.each do |path|
236+
terminal.write " - ", style: :covered_prefix
237+
terminal.puts path, style: :brief_path
238+
end
239+
end
240+
end
197241
end
198242

199243
class Quiet

0 commit comments

Comments
 (0)