vscode-ruby-test-adapter
vscode-ruby-test-adapter copied to clipboard
plugin is not working
Hello everybody! I installed Ruby Test Explorer but nothing is working. When I start VS Code I get next error:
Command failed: rspec --require c:\Users\shredder.vscode\extensions\connorshea.vscode-ruby-test-adapter-0.6.0\custom_formatter.rb --format CustomFormatter --order defined --dry-run
Source: Ruby Test Explorer
And this warning: Ruby Test Explorer failed to find an RSpec test suite. Make sure RSpec is installed and your configured RSpec command is correct.
Settings of Ruby Test Explorer
"rubyTestExplorer.rspecCommand": "rspec",
"rubyTestExplorer.rspecDirectory":
"C:\\Users\\shredder\\VisualStudioCodeProjects\\<project_name\\spec",
"rubyTestExplorer.logpanel": true
And there is nothing in Test menu

vscode-ruby-test-adapterversion: 0.6.0- Ruby version: 2.6.3
- VS Code version: 1.37.0
- Operating System: Windows 10
- RSpec version: rspec-core 3.8.2
Can you help me, please?
Hi! Do you have any log messages in the Developer Tools Console (Ctrl+Shift+P to open the command palette and then use "Developer: Toggle Developer Tools") or the Output panel (Ctrl+Shift+P to open the command palette and use "View: Toggle Output", then click the dropdown in the Output panel and switch to "Ruby Test Explorer Log") that seem relevant to the issue?
Also, do you have Ruby installed locally on Windows or in the Windows Subsystem for Linux?
Hi! I have ruby installed locally on Windows but I have tried to do same from WSL and had the same problem. Yes I have the next error in the Developer Tools Console
ERR Command failed: rspec --require c:\Users\shredder\.vscode\extensions\connorshea.vscode-ruby-test-adapter-0.6.0\custom_formatter.rb --format CustomFormatter --order defined --dry-run
SimpleCov failed with exit 1: Error: Command failed: rspec --require c:\Users\shredder\.vscode\extensions\connorshea.vscode-ruby-test-adapter-0.6.0\custom_formatter.rb --format CustomFormatter --order defined --dry-run
SimpleCov failed with exit 1
at ChildProcess.exithandler (child_process.js:299:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
I got the following error when I run single test:
stack trace: TypeError: Cannot read property 'status' of undefined
at RspecTests.handleStatus (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/out/rspecTests.js:95:18)
at RspecTests.<anonymous> (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/out/tests.js:282:26)
at Generator.next (<anonymous>)
at fulfilled (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/node_modules/tslib/tslib.js:104:62)
/Applications/Visual…kbench.main.js:1449 ERR Cannot read property 'status' of undefined: TypeError: Cannot read property 'status' of undefined
at RspecTests.handleStatus (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/out/rspecTests.js:95:18)
at RspecTests.<anonymous> (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/out/tests.js:282:26)
at Generator.next (<anonymous>)
at fulfilled (/Users/vucinjo/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/node_modules/tslib/tslib.js:104:62)
ruby 2.6.3 rspec 3.8.0
@ruslanshelar same issue as me. Mine is Mac.
@ruslanshelar OK I can run now. Just add gem 'rspec-rails','3.8.2' gem 'rspec-core','3.8.2' gem 'minitest'
to the test env. Make sure rspec-core is 3.8.2. (Seems 3.5.2 doesnt work)
The plugin isn't working for me either, though I have a very different situation:
I'm using VS Code v1.37 with Remote Containers/SSH (Vagrant VM)
Local OS: Mac OS 10.14.6 Remote VM: Vagrant VM (Linux 4.4.0-131-generic x86_64)
On the VM: Ruby 1.9.3 RSpec 3.6
- rspec-core 3.6.0
- rspec-expectations 3.6.0
- rspec-mocks 3.6.0
- rspec-support 3.6.0
I have an alias setup to run my tests (so that the environment is correctly configured), which I set as the test runner, however, many of our tests will not run, even in the VM (browser tests etc.) and so setting the 'spec' folder is not necessarily useful. I really just want to be able to test the currently open spec.
I get the following 2 errors at VS start up (no output in the log panel etc.):
Command failed: test --require /home/cnuapp/.vscode-server/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/custom_formatter.rb --format CustomFormatter --order defined --dry-run /bin/sh: 1: test: --require: unexpected operator
Ruby Test Explorer failed to find an RSpec test suite. Make sure RSpec is installed and your configured RSpec command is correct.
Ran into the same issue. I have rspec 3.8.2 installed. I've tried both the rspec and bundle exec commands. The command line argument initiated by the test explorer with the dry-run flag works when executed manually from command line in the workspace, both using rspec and bundle rspec. It appears the extension is not able to run it correctly.
Command failed: bundle exec rspec --require /Users/rezamalik/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/custom_formatter.rb --format CustomFormatter --order defined --dry-run
at ChildProcess.exithandler (child_process.js:299:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Socket.ChildProcess.spawn.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe.Socket._destroy._handle.close (net.js:606:12)
This plugin looks very useful, I'd like to use it too, but having problems.
It seems $EXT_DIR and/or $TESTS_DIR are not set? If I set them manually and execute the command myself it does something:
EXT_DIR=~/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.6.0/ruby/ TESTS_DIR=./test RAILS_ENV=test bundle exec rake -R $EXT_DIR vscode:minitest:list
But bails out on finding duplicate tests (which we don't have).
Additional to the above, when I don't run this in a workspace but in a project itself, things are starting to work. I had to remove one duplicate named test and then it all just works.
Does anyone have a repo I could look at to reproduce this issue? I’m on RSpec 3.8 and my Rails app works fine, so I’m not sure what’s causing the problems.
@vucinjo were you using the Remote extensions, and what version of VS Code?
@connorshea No. I don't have remote extensions installed. Here are the version details: Version: 1.38.0 Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Darwin x64 18.7.0
I had the same bug on MacOS and solved it by:
- Updating the gemfile (which forced an old version of rspec, I now use
gem "rspec", "~> 3.9.0" - Updated the gem itself using gem update
- Adding the following in settings.json (I use rbenv):
"rubyTestExplorer.testFramework": "auto"
"rubyTestExplorer.rspecCommand": "/Users/<username>/.rbenv/shims/bundle exec rspec",
"rubyTestExplorer.rspecDirectory": "./spec/"
Not working for me either, the tests don't even show up on the sidebar. I'm using vscodium and minitest but it should be working nonetheless. This is the output in developer tools:
Activating extension 'connorshea.vscode-ruby-test-adapter' failed: Cannot find module '/Users/<username>/.vscode-oss/extensions/connorshea.vscode-ruby-test-adapter-0.7.1/out/main.js'
Require stack:
- /Applications/VSCodium.app/Contents/Resources/app/out/vs/loader.js
- /Applications/VSCodium.app/Contents/Resources/app/out/bootstrap-amd.js
- /Applications/VSCodium.app/Contents/Resources/app/out/bootstrap-fork.js.
My settings.json:
{
"workbench.colorTheme": "Community Material Theme Palenight High Contrast",
"workbench.iconTheme": "material-icon-theme",
"ruby.useBundler": true, //run non-lint commands with bundle exec
"ruby.useLanguageServer": true, // use the internal language server (see below)
"ruby.lint": {
"rubocop": {
"useBundler": false // enable rubocop via bundler
}
},
"files.associations": {
"*.erb": "erb"
},
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.fontFamily": "FiraCode-Retina",
"ruby.format": "rubocop", // use rubocop for formatting
"solargraph.autoformat": true,
"ruby.rubocop.executePath": "/Users/<username>/.rbenv/shims/rubocop",
"ruby.rubocop.onSave": true,
"rubyTestExplorer.testFramework": "auto",
"rubyTestExplorer.minitestCommand": "/Users/<username>/.rbenv/shims/bundle exec minitest",
"rubyTestExplorer.minitestDirectory": "./test/",
"rubyTestExplorer.filePattern": [
"*_test.rb",
"test_*.rb",
"*_spec.rb"
],
"rubyTestExplorer.logpanel": true
Not working for me either
@Duartemartins Same here:
[2021-12-24 14:23:32.544] [exthost] [info] ExtensionService#_doActivateExtension connorshea.vscode-ruby-test-adapter, startup: true, activationEvent: 'workspaceContains:**/Rakefile,**/Gemfile,**/*.rb'
[2021-12-24 14:23:32.554] [exthost] [error] Activating extension connorshea.vscode-ruby-test-adapter failed due to an error:
[2021-12-24 14:23:32.554] [exthost] [error] Error: Cannot find module '/home/me/.vscode-oss/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/out/src/main.js'
Require stack:
- /usr/share/codium/resources/app/out/vs/loader.js
- /usr/share/codium/resources/app/out/bootstrap-amd.js
- /usr/share/codium/resources/app/out/bootstrap-fork.js
I checked the filesystem and /home/me/.vscode-oss/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/out/src/main.js does not exist. The out dir does not exist.
Well, i rebuilt the plugin and it seems to do the trick (at least tests are showing):
cd ~/.vscode-oss/extensions/
rm -rf connorshea.vscode-ruby-test-adapter-0.9.0
git clone [email protected]:connorshea/vscode-ruby-test-adapter.git connorshea.vscode-ruby-test-adapter-0.9.0
cd connorshea.vscode-ruby-test-adapter-0.9.0
bin/setup
npx tsc