Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
logic and some old rspec helper files)
- Removed handling of a Ruby 2.1 system error ([luke-hill](https://github.com/luke-hill))
- Removed support for Ruby 3.1 and 3.2 (Minimum ruby is now 3.3) ([luke-hill](https://github.com/luke-hill))


### Fixed
- Updated the `html-formatter` to access message stream correctly ([#1899](https://github.com/cucumber/cucumber-ruby/pull/1899)) [brasmusson](https://github.com/brasmusson)

## [11.1.1] - 2026-06-25
### Changed
- Change to use events to pass the data from "log" and "attach" calls from the step definitions to the formatters. With this the last part of the ancient (pre event) formatter inteface has been removed. ([#1881](https://github.com/cucumber/cucumber-ruby/pull/1881) [brasmusson](https://github.com/brasmusson))
Expand Down
4 changes: 4 additions & 0 deletions features/docs/formatters/html.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ Feature: html formatter
When I run `cucumber features/my_feature.feature --format html`
Then it should fail
And output should be html with title "Cucumber"
And the output should contain:
"""
Scenario Outline: a scenario
"""
10 changes: 6 additions & 4 deletions lib/cucumber/formatter/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

require 'cucumber/html_formatter'

require_relative 'message_builder'
require_relative 'io'

module Cucumber
module Formatter
class HTML < MessageBuilder
class HTML
include Io

def initialize(config)
@config = config
@io = ensure_io(config.out_stream, config.error_stream)
@html_formatter = Cucumber::HTMLFormatter::Formatter.new(@io)
@html_formatter.write_pre_message
super(config)
config.on_event :envelope, &method(:on_envelope)
end

def on_envelope(event)
super(event)
envelope = event.envelope
@html_formatter.write_message(envelope)
# TODO: Move this conditional logic into the HTML formatter proper
Expand Down
9 changes: 4 additions & 5 deletions lib/cucumber/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,13 @@ def set_encoding
require 'cucumber/core/report/summary'

def create_formatters
# Define all formatters which are specified via cli options
formatters
# Define the MessageBuilder formatter - Required until all messages are generated at the source
# Skip when a user formatter already inherits from MessageBuilder (e.g. HTML) to avoid sending every event twice.
message_builder unless formatters.any? { |f| f.is_a?(Formatter::MessageBuilder) }
# Define the MessageBuilder - Required until all messages are generated at the source
message_builder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need re-ordering and going above formatters

# `summary_report` and `global_hooks_summary_report` are used to determine the exit code
summary_report
global_hooks_summary_report
# Define all formatters which are specified via cli options
formatters
fail_fast_report if @configuration.fail_fast?
publish_banner_printer unless @configuration.publish_quiet?
end
Expand Down