Skip to content

Commit c4fe474

Browse files
committed
Respect the project's development dependencies when running console tests
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.
1 parent 0b77e82 commit c4fe474

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/support/console_test_case.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ def debug_code(program, remote: true, verbose: false, &test_steps)
120120
end
121121

122122
def run_test_scenario cmd, test_info, verbose: false
123-
PTY.spawn({ "HOME" => pty_home_dir }, cmd) do |read, write, pid|
123+
env = { "HOME" => pty_home_dir }
124+
125+
if ENV.key?('BUNDLE_GEMFILE')
126+
env["RUBYOPT"] = '-rbundler/setup'
127+
end
128+
129+
PTY.spawn(env, cmd) do |read, write, pid|
124130
test_info.backlog = []
125131
test_info.last_backlog = []
126132
begin

0 commit comments

Comments
 (0)