Skip to content

HTML report truncated at window.CUCUMBER_MESSAGES = [Β #1890

@oellul

Description

@oellul

πŸ‘“ What did you see?

The generated HTML report ends with this line:

<script>
window.CUCUMBER_MESSAGES = [

βœ… What did you expect to see?

window.CUCUMBER_MESSAGES array should be populated:

<script>
window.CUCUMBER_MESSAGES = [
{"meta":{"protocolVersion":"32.3.1","implementation":{"name":"cucumber-ruby","version":"11.1.0"},"runtime":{"name":"ruby","version":"4.0.5"},"os":{"name":"linux","version":"#1 SMP PREEMPT_DYNAMIC Sun, 17 May 2026 17:23:07 +0000"},"cpu":{"name":"x86_64"}}},
...
]
</script>

πŸ“¦ Which tool/library version are you using?

ruby v4.0.5
cucumber-ruby v11.1.0
linux

πŸ”¬ How could we reproduce it?

  1. Setup a blank project
  2. Add Gemfile
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'cucumber'
  1. Add basic feature file: features/feature/test.feature
Feature: Test

  Scenario: Run a step
    When I run a single step
  1. Add step definition: features/step_definitions/test.rb
# frozen_string_literal: true

When('I run a single step') do
  expect(1).to eq(1)
end
  1. Run bundle install
  2. Run bundle exec cucumber --format html --out report.html

πŸ“š Any additional context?

I found that the probable cause was that output_envelope is defined but not subscribed to the :envelope event

I am working around the issue with this monkey-patch:
features/support/html_formatter_fix.rb

# frozen_string_literal: true

require 'cucumber/formatter/html'

module Cucumber
  module Formatter
    class HTML
      alias _bugfix_original_initialize initialize

      def initialize(config)
        _bugfix_original_initialize(config)
        config.on_event(:envelope) do |event|
          envelope = event.envelope
          @html_formatter.write_message(envelope)
          @html_formatter.write_post_message if envelope.test_run_finished
        end
      end
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions