Class: Cucumber::Formatter::ConsoleIssues

Inherits:
Object
  • Object
show all
Includes:
Console
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/console_issues.rb

Constant Summary

Constants included from ANSIColor

ANSIColor::ALIASES

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Method Summary collapse

Methods included from Console

#attach, #collect_snippet_data, #collect_undefined_parameter_type_names, #do_print_passing_wip, #do_print_profile_information, #do_print_snippets, #do_print_undefined_parameter_type_snippet, #exception_message_string, #format_step, #format_string, #indent, #linebreaks, #print_element_messages, #print_elements, #print_exception, #print_passing_wip, #print_profile_information, #print_snippets, #print_statistics

Methods included from ANSIColor

#apply_custom_colors, #cukes, #green_cukes, #red_cukes, #yellow_cukes

Methods included from Term::ANSIColor

#attributes, included, #uncolored

Methods included from Duration

#format_duration

Constructor Details

#initialize(config, ast_lookup = AstLookup.new(config)) ⇒ ConsoleIssues

Returns a new instance of ConsoleIssues.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/console_issues.rb', line 8

def initialize(config, ast_lookup = AstLookup.new(config))
  @previous_test_case = nil
  @issues = Hash.new { |h, k| h[k] = [] }
  @config = config
  @config.on_event(:test_case_finished) do |event|
    if event.test_case != @previous_test_case
      @previous_test_case = event.test_case
      @issues[event.result.to_sym] << event.test_case unless event.result.ok?(@config.strict)
    elsif event.result.passed?
      @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict.strict?(:flaky))
      @issues[:failed].delete(event.test_case)
    end
  end
  @ast_lookup = ast_lookup
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/console_issues.rb', line 31

def any?
  @issues.any?
end

#to_sObject



24
25
26
27
28
29
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/console_issues.rb', line 24

def to_s
  return if @issues.empty?

  result = Core::Test::Result::TYPES.map { |type| scenario_listing(type, @issues[type]) }
  result.flatten.join("\n")
end