This is a Ruby Test Explorer extension for the VS Code Test Explorer extension.
The extension supports the RSpec and Minitest test frameworks.
The extension needs Ruby and the
rspec-core gem installed (and any other dependencies required by your test suite). It's been tested with Ruby 2.6 and Rspec 3.8, but it should work with most recent versions of Ruby and all versions of Rspec 3.x above 3.6.0 (versions before 3.6.0 do not currently work because they don't expose an
id property for tests in the JSON formatter).
By default, you need to have
rspec installed via Bundler with a
bundle install, otherwise
bundle exec rspec won't work. If you want to run your Rspec tests with a command other than
bundle exec rspec, you can configure the command with the
The extension needs Ruby and the
minitest gem installed (and any other dependencies required by your test suite). It's been tested with Ruby 2.5 and 2.6, and Minitest 5.x. It should work with most recent versions of Ruby and Minitest.
bundle list), as well as manual override if necessary.
The following configuration options are available:
||Whether to write diagnotic logs to an output panel.|
||Write diagnostic logs to the given file.|
||Define the pattern to match test files by, for example
||Define the host to connect the debugger to, for example
||Define the port to connect the debugger to, for example
||Define how to run rdebug-ide, for example
||Define the command to run RSpec tests with, for example
||Define the relative directory of the specs in a given workspace, for example
||Define how to run Minitest with Rake, for example
||Define the relative location of your
If the extension doesn't work for you, here are a few things you can try:
bundle installand that any gems specified in your
Gemfile.lockhave been installed (assuming you're using Bundler).
rubyTestExplorer.logpanelconfig setting and take a look at the output in Output > Ruby Test Explorer Log. This should show what the extension is doing and provide more context on what's happening behind the scenes. (You can alternatively use
rubyTestExplorer.logfileto log to a specific file instead).
rspec-coregem. If you're on a version prior to 3.6.0, the extension may not work.
specdirectory are configured correctly. By default, tests are run with
bundle exec rspecand the tests are assumed to be in the
./spec/directory. You can configure these with
testFrameworkconfig may be set to
noneor the auto-detect may be failing to determine the test framework. Try setting the
minitestdepending on what you want to use.
If all else fails or you suspect something is broken with the extension, please feel free to open an issue! :)
You'll need VS Code, Node (any version >= 8 should probably work), and Ruby installed.
git clone https://github.com/connorshea/vscode-ruby-test-adapter
bin/setupto install dependencies.
npm run watchor start the
watchTask in VS Code to get the TypeScript compiler running.
This extension is based on the example test adapter, it may be useful to check that repository for more information. Test adapters for other languages may also be useful references.
There are two groups of tests included in the repository.
bundle exec rakein
npm run build && npm run packagebefore you'll be able to successfully run the extension tests. You'll also need to re-run these every time you make changes to the extension code or your tests.
You can see
.github/workflows/test.yml for CI configurations.
See the VS Code extension docs for more info.
Before publishing, make sure to update the
CHANGELOG.md file. You also need to be logged in to
vsce. When creating a Personal Access Token to log in, make sure to give it access to all organizations in your Azure DevOps account. Otherwise, it won't work correctly.
vsce publish VERSION, e.g.
vsce publish 1.0.0 will automatically handle creating the git commit and git tag, updating the
package.json, and publishing the new version to the Visual Studio Marketplace. You'll need to manually run
git push and
git push --tags after publishing.
Alternatively, you can bump the extension version with
vsce publish major,
vsce publish minor, or
vsce publish patch.