Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension using wrong Ruby executable/in wrong environment #119

Open
RyanVerhey opened this issue Mar 22, 2023 · 1 comment
Open

Extension using wrong Ruby executable/in wrong environment #119

RyanVerhey opened this issue Mar 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@RyanVerhey
Copy link

RyanVerhey commented Mar 22, 2023

Your environment

  • vscode-ruby-test-adapter version: v0.9.2
  • Ruby version: 2.7.6p219
  • VS Code version: 1.76.2
  • Operating System: macOS 13.1
  • RSpec or Minitest version: minitest 5.17.0

Expected behavior

Extension would use appropriate ruby executable

Actual behavior

I am using asdf as a version manager for Ruby. In my Rails directory, I have both a .ruby-version and a .tool-versions file. which ruby in my terminal outputs /Users/[redacted]/.asdf/shims/ruby. However, when the extension loads, it uses the system Ruby:

[2023-03-22 20:27:03.602] [INFO] Test Explorer found
[2023-03-22 20:27:03.602] [INFO] Creating adapter for /Users/[redacted]/repo
[2023-03-22 20:27:03.602] [INFO] Initializing Ruby adapter
[2023-03-22 20:27:03.602] [INFO] Registering adapter for /Users/[redacted]/repo
[2023-03-22 20:27:03.603] [INFO] Loading Ruby tests...
[2023-03-22 20:27:03.603] [INFO] Loading Minitest tests...
[2023-03-22 20:27:03.603] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list
[2023-03-22 20:27:03.603] [INFO] Initialization finished
[2023-03-22 20:27:03.637] [INFO] Configuration changed
[2023-03-22 20:27:03.721] [ERROR] Error while finding Minitest test suite: Command failed: bundle exec rake -R $EXT_DIR vscode:minitest:list
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.2.33) required by your /Users/[redacted]/repo/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.33`
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
	from /usr/bin/bundle:23:in `<main>'

[2023-03-22 20:27:03.721] [ERROR] Output: 
[2023-03-22 20:27:03.743] [INFO] Configuration changed

Strangely, my exact configuration was working a couple of weeks ago, but isn't today. It's almost as if VSCode started using a different shell, as I'm also having issues running Rails in the Debug pane when it worked fine a couple of weeks ago.

I tried using the minitest command rake and I got a different, but similar error:

Bundler::LockfileError: You must use Bundler 2 or greater with this lockfile.
/Users/[redacted]/repo/config/boot.rb:3:in `<top (required)>'
/Users/[redacted]/repo/config/application.rb:1:in `require_relative'
/Users/[redacted]/repo/config/application.rb:1:in `<top (required)>'
/Users/[redacted]/repo/Rakefile:4:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'

Caused by:
Gem::MissingSpecVersionError: Could not find 'bundler' (2.2.33) required by your /Users/[redacted]/repo/Gemfile.lock.
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.33`
Checked in 'GEM_PATH=/Library/Ruby/Gems/2.6.0:/Users/[redacted]/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information
/Users/[redacted]/repo/config/boot.rb:3:in `<top (required)>'
/Users/[redacted]/repo/config/application.rb:1:in `require_relative'
/Users/[redacted]/repo/config/application.rb:1:in `<top (required)>'
/Users/[redacted]/repo/Rakefile:4:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

I am using zsh, and the default terminal profile for VSCode also uses zsh

@RyanVerhey RyanVerhey added the bug Something isn't working label Mar 22, 2023
@pheisiph
Copy link

pheisiph commented Jul 26, 2023

I ran into the same issue with the same configuration. Turns out that another rspec related extension was the cause - I also had https://github.com/DouglasRochaT/spec-utils installed and enabled. Deactivating this extension fixed it for me. (Your mileage may vary)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants