Not sure what's wrong with my setup. I've been stuck on this issue for a day now and still hasn't resolved this. I've setup my VScode so I can debug my specs (for Ruby on Rails) faster. I followed this guide on Github, originally stumbled upon this Stackoverflow thread here.
I've added ruby-debug-ide & debase under the development and test group in my gem file & execute $ bundle install
. They seem to be working ok (I think) based on what I can see on my debug console.
Gemfile:
group :development, :test do
gem 'ruby-debug-ide'
gem 'debase'
end
Debug console:
This is how it looks like after pressing F5 or clicking the "Run" button under the Run & Debug tab on VSCode.
Looking at this part of the debug console I know that my spec file is being executed properly:
Launch.json file:
{
"configurations": [
{
"name": "Debug RSpec - open spec file",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"useBundler": true,
"pathToBundler": "/Users/<my computer name>/.rbenv/shims/bundle",
"pathToRDebugIDE": "/Users/<my computer name>/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ruby-debug-ide-0.7.3",
"debuggerPort": "1235",
"program": "${workspaceRoot}/bin/rspec",
"args": [
"${file}"
],
"showDebuggerOutput": true
},
]
}
I've added a breakpoint on my spec file (even tried adding multiple breakpoints) but it's debugger isn't hitting any of it. Made sure it's turned on (See screenshot below).
Other info about my setup that might help, tell me if you need more info:
- Machine is MBP 2021 Intel
- OS: Mac OS Monterey 12.0.1
- Latest version of VSCode installed
- Ruby version: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin20
- Rails version: Rails 5.2.3
- Version manager: RBenv