Skip to content

Commit

Permalink
Use plain irb in debugging scenario
Browse files Browse the repository at this point in the history
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 #910. Also, see
ruby/reline#616 for the resulting reline
issue.
  • Loading branch information
mvz committed Dec 23, 2023
1 parent aa2114b commit bdf5ede
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bdf5ede

Please sign in to comment.