Forum Discussion

DanielFrampton's avatar
DanielFrampton
New Contributor
3 years ago
Solved

All comments in feature file printed to console

Hello Cucumber community!   I'm upgrading my organization's Ruby environment used for automated testing, and making a big leap forward in our Cucumber gem version from 1.3.20 (!!!) to 6.0.   In t...
  • aurelien-reeves's avatar
    3 years ago

    The change in cucumber@4.0 has been introduced in the following commit: https://github.com/cucumber/cucumber-ruby/commit/22c4f13dd0f8b3b0eac593d881b814328a3e49e2

     

    It has not been documented, but it looks like it has been intentional, so it seems to be expected behavior. And no option to disable it.

     

    In your case, if those comments after the last scenario are an issue, you may consider monkey patching the "Pretty" formatter. For example, if your support code is in `features/support`, you could add a `formatter` folder with `pretty.rb` with the following content:

     

     

     

    # features/support/formatter/pretty.rb
    # frozen_string_literal: true
    
    require 'cucumber/formatter/pretty'
    
    module Cucumber
      module Formatter
        class Pretty
          def on_test_run_finished(_event)
            print_summary
          end
        end
      end
    end