Skip to content

Fix test suite compatibility with Cucumber 11.x - #107

Open
voxik wants to merge 1 commit into
cucumber:mainfrom
voxik:cucumber-11-compat
Open

Fix test suite compatibility with Cucumber 11.x#107
voxik wants to merge 1 commit into
cucumber:mainfrom
voxik:cucumber-11-compat

Conversation

@voxik

@voxik voxik commented Aug 24, 2026

Copy link
Copy Markdown

Working of updating Cucumber in Fedora, I have hit test errors like this:

  Expected `cucumber --dry-run --no-snippets -f progress` to succeed but got non-zero exit status and the following output:
  
  UNot understood: ["snippet_text",{"step_keyword":"Given","step_name":"we're all wired","multiline_arg_class":""}]
   (Cucumber::Wire::Exception)

Looking around, it seems that these are also reproducible in CI:

https://github.com/cucumber/cucumber-ruby-wire/actions/runs/32449556323/job/96675300799

The reason for this error is that this commit added output_snippet_envelope to MessageBuilder, which unconditionally sends a snippet_text request over the wire protocol whenever a step result is undefined, even during --dry-run --no-snippets runs. This bypasses the --no-snippets guard that only affects console formatters, because MessageBuilder is now always instantiated regardless of the selected formatter.

Originally, I was thinking about this workaround:

diff --git a/features/erb_configuration.feature b/features/erb_configuration.feature
index 9f4e97b..bf2135d 100644
--- a/features/erb_configuration.feature
+++ b/features/erb_configuration.feature
@@ -25,6 +25,7 @@ Feature: ERB configuration
       And there is a wire server running on port 12345 which understands the following protocol:
         | request                                              | response       |
         | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
+        | ["snippet_text",{"step_keyword":"Given","step_name":"we're all wired","multiline_arg_class":""}] | ["success",""] |
       When I run `cucumber --dry-run --no-snippets -f progress`
       Then it should pass with:
         """
@@ -44,6 +45,7 @@ Feature: ERB configuration
       And there is a wire server running on port 16816 which understands the following protocol:
         | request                                              | response       |
         | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
+        | ["snippet_text",{"step_keyword":"Given","step_name":"we're all wired","multiline_arg_class":""}] | ["success",""] |
       When I run `cucumber --dry-run --no-snippets -f progress --publish-quiet`
       Then it should pass with:
         """
diff --git a/features/step_matches_message.feature b/features/step_matches_message.feature
index 4269afb..7a60820 100644
--- a/features/step_matches_message.feature
+++ b/features/step_matches_message.feature
@@ -35,6 +35,7 @@ Feature: Step matches message
     Given there is a wire server running on port 54321 which understands the following protocol:
       | request                                              | response       |
       | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
+      | ["snippet_text",{"step_keyword":"Given","step_name":"we're all wired","multiline_arg_class":""}] | ["success",""] |
     When I run `cucumber --dry-run --no-snippets -f progress`
     And it should pass with:
       """

But maybe it might be better to let the FakeWireServer to silently return a neutral success response for messages that Cucumber may send unconditionally but that individual scenarios have no reason to handle.

Commit a1701d55f added `output_snippet_envelope` to `MessageBuilder`,
which unconditionally sends a `snippet_text` request over the wire
protocol whenever a step result is undefined, even during `--dry-run
--no-snippets` runs. This bypasses the `--no-snippets` guard that only
affects console formatters, because MessageBuilder is now always
instantiated regardless of the selected formatter.

Let FakeWireServer to silently return a neutral success response
for messages that Cucumber may send unconditionally but that individual
scenarios have no reason to handle.

Assisted-by: Claude Sonnet 4.6
@mpkorstanje
mpkorstanje requested a review from luke-hill August 31, 2026 16:10
@luke-hill

Copy link
Copy Markdown
Contributor

@voxik thankyou for the bug. I'll be honest I never considered --no-snippets so maybe there is something to fix there too in cucumber-ruby.

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.

2 participants