From bdf5edee50d6fda19a05147d1269370340b642c4 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 8 Dec 2023 16:10:57 +0100 Subject: [PATCH] Use plain irb in debugging scenario In Ruby 3.3, requiring readline does not load the real readline library but falls back to reline by default. This creates odd output when the terminal is not a real TTY and a prompt is used when getting input. Because pry uses a prompt, this makes the interactive debugging scenario fail. This change works around this issue by switching to irb. Irb will not use a prompt, possibly because the output is not a TTY. See https://github.com/cucumber/aruba/issues/910. Also, see https://github.com/ruby/reline/issues/616 for the resulting reline issue. --- .../command/debug_your_command_in_aruba.feature | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature b/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature index 1c7bbc1cd..7a0f2785f 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature @@ -10,15 +10,15 @@ Feature: Debug your command in cucumber-test-run Scenario: You can use a debug repl in your cli program If you want to debug an error, which only occurs in one of your - `cucumber`-tests, the `@debug`-tag becomes handy. This will use the + Cucumber tests, the `@debug`-tag becomes handy. This will use the DebugProcess runner, making your program use the default stdin, stdout and stderr streams so you can interact with it directly. - This will, for example, make `binding.pry` and `byebug` work in your + This will, for example, make `binding.irb` and `byebug` work in your program. However, Aruba steps that access the input and output of your program will not work. - We are going to demonstrate this using `pry`, but any other interactive + We are going to demonstrate this using `irb`, but any other interactive debugger for any other programming language should also work. Given an executable named "bin/aruba-test-cli" with: @@ -27,8 +27,7 @@ Feature: Debug your command in cucumber-test-run foo = 'hello' - require 'pry' - binding.pry + binding.irb """ And a file named "features/debug.feature" with: """cucumber @@ -44,9 +43,9 @@ Feature: Debug your command in cucumber-test-run And I type "exit" Then the output should contain: """ - [1] pry(main)> foo - => "hello" - [2] pry(main)> exit + foo + "hello" + exit """ Scenario: Can handle announcers