Skip to content

bugfix: HTML Formatter and its envelopes#1891

Open
luke-hill wants to merge 11 commits into
mainfrom
bugfix/html_formatter_inheritance
Open

bugfix: HTML Formatter and its envelopes#1891
luke-hill wants to merge 11 commits into
mainfrom
bugfix/html_formatter_inheritance

Conversation

@luke-hill

Copy link
Copy Markdown
Contributor

Description

Fix HTML formatter not running output_envelope correctly

fixes #1890

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Please add an entry to the relevant section of CHANGELOG.md as part of this pull request.

Checklist:

Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@luke-hill

Copy link
Copy Markdown
Contributor Author

@oellul this is a quick attempt at fixing it.

One thing to note, is this might not play well with attachments, especially those from hooks. So for now I want to let this sit for a short while

@oellul

oellul commented Jun 4, 2026

Copy link
Copy Markdown

No worries, take your time. My monkey-patch seems to be serving my use case well for now (probably because I don't use attachments)

@luke-hill

Copy link
Copy Markdown
Contributor Author

@oellul can you test this branch though with attachments. To see if you can remove your monkeypatch. I want to merge this in as it is an oversight on our end

Comment thread lib/cucumber/formatter/html.rb Outdated
@oellul

oellul commented Jun 4, 2026

Copy link
Copy Markdown

Sure thing, I'll test it out tomorrow and let you know

@oellul

oellul commented Jun 5, 2026

Copy link
Copy Markdown

@luke-hill You're right, it doesn't play well with attachments.

This step def

When('I attach an image') do
  image_path = File.read('image.jpeg', mode: 'rb')
  attach(image_path, 'image/jpeg')
end

is failing with error message "\xFF" from ASCII-8BIT to UTF-8 (JSON::GeneratorError)

This particular issue is fixed when changing cucumber/formatter/message_builder.rb line 77 to if streamed_file || src.encoding == Encoding::ASCII_8BIT to ensure that it is encoded as base64

luke-hill and others added 2 commits June 8, 2026 14:24
* Fix up arabic translation example
Fix step defs to use native terms
Fix capture to ensure scenario will work

* Permit arabic to run again in CI

* Switch ukranian to use anglicised step def code to permit example to be ran in CI - Still validly testing the parser and the localised terms in gherkin

* Switch uzbek to use anglicised step def code to permit example to be ran in CI - Still validly testing the parser and the localised terms in gherkin

* Switch russian to use anglicised step def code to permit example to be ran in CI - Still validly testing the parser and the localised terms in gherkin

* Enhance test suite to run all new examples

* Add note

* Add changelog
* Remove the ancient procedure call interface from formatters completely
* Until now the data from "attach" and "log" calls from step definitions
  has been passed to the formatter using the ancient procedure call
  interface used in Cucumber-Ruby v1 and v2. From Cucumber-Ruby v3 all
  other data to formatters has been passed using events.
* Introduce an event AttachCalled to pass the data from "attach" and
  "log" calls from step definitions to event listeners like formatters.
* Update Changelog.md
@luke-hill luke-hill force-pushed the bugfix/html_formatter_inheritance branch from e34037c to 4134b83 Compare June 8, 2026 13:29
@luke-hill luke-hill force-pushed the bugfix/html_formatter_inheritance branch from 52f9a52 to 55d09e7 Compare June 8, 2026 13:32
@luke-hill

Copy link
Copy Markdown
Contributor Author

Not quite sure what went on with merges / interactive rebases but @oellul could you take a look here again. Both with positive and negative scenarios for the html formatter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTML report truncated at window.CUCUMBER_MESSAGES = [

4 participants