Merge pull request #4908 from jekyll/add-timing-cucumber
Merge pull request 4908
This commit is contained in:
commit
eba9a2716b
|
@ -30,6 +30,7 @@ module Jekyll
|
||||||
@options = options
|
@options = options
|
||||||
@exceptions = []
|
@exceptions = []
|
||||||
@indent = 0
|
@indent = 0
|
||||||
|
@timings = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -42,6 +43,7 @@ module Jekyll
|
||||||
|
|
||||||
def after_features(features)
|
def after_features(features)
|
||||||
@io.puts
|
@io.puts
|
||||||
|
print_worst_offenders
|
||||||
print_summary(features)
|
print_summary(features)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,23 +56,35 @@ module Jekyll
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
def feature_element_timing_key(feature_element)
|
||||||
|
"\"#{feature_element.name.to_s.sub("Scenario: ", "")}\" (#{feature_element.location})"
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
def before_feature_element(feature_element)
|
||||||
|
@indent = 2
|
||||||
|
@scenario_indent = 2
|
||||||
|
@timings[feature_element_timing_key(feature_element)] = Time.now
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
def after_feature_element(feature_element)
|
||||||
|
@timings[feature_element_timing_key(feature_element)] = Time.now - @timings[feature_element_timing_key(feature_element)]
|
||||||
|
@io.print " (#{@timings[feature_element_timing_key(feature_element)]}s)"
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
def tag_name(tag_name); end
|
def tag_name(tag_name); end
|
||||||
|
|
||||||
def comment_line(comment_line); end
|
def comment_line(comment_line); end
|
||||||
|
|
||||||
def after_feature_element(feature_element); end
|
|
||||||
|
|
||||||
def after_tags(tags); end
|
def after_tags(tags); end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
def before_feature_element(_feature_element)
|
|
||||||
@indent = 2
|
|
||||||
@scenario_indent = 2
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
def before_background(_background)
|
def before_background(_background)
|
||||||
@scenario_indent = 2
|
@scenario_indent = 2
|
||||||
@in_background = true
|
@in_background = true
|
||||||
|
@ -178,6 +192,17 @@ module Jekyll
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
def print_worst_offenders
|
||||||
|
@io.puts
|
||||||
|
@io.puts "Worst offenders:"
|
||||||
|
@timings.sort_by { |_f, t| -t }.take(10).each do |(f, t)|
|
||||||
|
@io.puts " #{t}s for #{f}"
|
||||||
|
end
|
||||||
|
@io.puts
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
def print_summary(features)
|
def print_summary(features)
|
||||||
@io.puts
|
@io.puts
|
||||||
print_stats(features, @options)
|
print_stats(features, @options)
|
||||||
|
|
Loading…
Reference in New Issue