diff --git a/CHANGELOG.md b/CHANGELOG.md index 302921dab..4346791ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo All logic contained in [compatibility](./compatibility) ([luke-hill](https://github.com/luke-hill)) ### Fixed +- Fix a situation whereby the step definition message will omit the parameter-type name when it cannot be inferred + (This fixes an issue in cucumber-wire when passing legacy steps down the wire) + ([#1746](https://github.com/cucumber/cucumber-ruby/pull/1746) [luke-hill](https://github.com/luke-hill)) ### Removed diff --git a/lib/cucumber/formatter/message_builder.rb b/lib/cucumber/formatter/message_builder.rb index e834b46b6..aebec612d 100644 --- a/lib/cucumber/formatter/message_builder.rb +++ b/lib/cucumber/formatter/message_builder.rb @@ -132,7 +132,7 @@ def step_match_arguments(step) @step_definitions_by_test_step.step_match_arguments(step).map do |argument| Cucumber::Messages::StepMatchArgument.new( group: argument_group_to_message(argument.group), - parameter_type_name: argument.parameter_type.name + parameter_type_name: parameter_type_name(argument) ) end end @@ -145,6 +145,10 @@ def argument_group_to_message(group) ) end + def parameter_type_name(step_match_argument) + step_match_argument.parameter_type&.name if step_match_argument.respond_to?(:parameter_type) + end + def on_test_run_started(*) message = Cucumber::Messages::Envelope.new( test_run_started: Cucumber::Messages::TestRunStarted.new(