From c4fe47486f73c99e6581ae7947760c662097634a Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 11 Apr 2024 12:58:42 +0100 Subject: [PATCH] Respect the project's development dependencies when running console tests When investigating the issue related to https://github.com/ruby/irb/pull/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. --- test/support/console_test_case.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/support/console_test_case.rb b/test/support/console_test_case.rb index f7e62fb4b..1f760e56b 100644 --- a/test/support/console_test_case.rb +++ b/test/support/console_test_case.rb @@ -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