Skip to content

Commit

Permalink
Respect the project's development dependencies when running console t…
Browse files Browse the repository at this point in the history
…ests

When investigating the issue related to ruby/irb#919,
I realized that console tests aren't executed with the IRB version specified
in the project's Gemfile. This is because the rdbg command passed to PTY process
doesn't use Bundler.

This commit changes the PTY's rdbg command to use Bundler if the test is
executed with it. This will make it significantly easier to
debug issues related to IRB or Reline changes.
  • Loading branch information
st0012 committed Apr 11, 2024
1 parent 0b77e82 commit c4fe474
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/support/console_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ def debug_code(program, remote: true, verbose: false, &test_steps)
end

def run_test_scenario cmd, test_info, verbose: false
PTY.spawn({ "HOME" => pty_home_dir }, cmd) do |read, write, pid|
env = { "HOME" => pty_home_dir }

if ENV.key?('BUNDLE_GEMFILE')
env["RUBYOPT"] = '-rbundler/setup'
end

PTY.spawn(env, cmd) do |read, write, pid|
test_info.backlog = []
test_info.last_backlog = []
begin
Expand Down

0 comments on commit c4fe474

Please sign in to comment.