Skip to content

Commit 6e746c9

Browse files
authored
bugfix: crash when Cucumber::Messages::Group#children is nil (#1819)
This change fixes the `undefined method 'map' for nil (NoMethodError)` for `cucumber-10.2.0/lib/cucumber/formatter/message_builder.rb:144`: `'Cucumber::Formatter::MessageBuilder#argument_group_to_message'` caused by: * Dec 11, 2025: #1805 allows to pull `cucumber-cucumber-expressions` `19.0.0` * Jan 21, 2026: cucumber/messages#370 introduce a breaking change that allows the `children` field of `Cucumber::Messages::Group` to be `nil` * Jan 21, 2026: cucumber/cucumber-expressions#387 `ruby/lib/cucumber/cucumber_expressions/group_builder.rb` sets the `children` to `nil` if `empty?` * Jan 26, 2026: The `cucumber-cucumber-expressions` `19.0.0` gem released and will be pulled in by `cucumber` `10.2.0` that raises the error The fix is simply accept the `nil` value for `Cucumber::Messages::Group#children`.
1 parent 78e472d commit 6e746c9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
1515
> This is currently not consumed anywhere, but will become the building blocks for the future of cucumber formatters
1616
> which we hope to begin migrating to in the start of 2026
1717
18+
### Fixed
19+
- Fix crash when `Cucumber::Messages::Group#children` is `nil`
20+
1821
## [10.2.0] - 2025-12-10
1922
### Changed
2023
- Permit the latest version of the `cucumber-html-formatter` (v22.0.0+)

lib/cucumber/formatter/message_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def argument_group_to_message(group)
143143
Cucumber::Messages::Group.new(
144144
start: group.start,
145145
value: group.value,
146-
children: group.children.map { |child| argument_group_to_message(child) }
146+
children: group.children&.map { |child| argument_group_to_message(child) }
147147
)
148148
end
149149

0 commit comments

Comments
 (0)