Run your rails tests smoothly from within Visual Studio Code
To allow users to easily and quickly run either individual tests or the whole test suite in a rails project no matter if they use minitest, rspec or cucumber.
The extension currently only supports rspec but should eventually support the most popular test runners.
Configures what command will be used to execute the tests
- Type:
string
- Default:
bundle exec rspec
If set to true (default) the terminal will be cleared on each new run.
- Type:
boolean
- Default: true
If set to true (default) the terminal will be focused when a test run is being initiated
- Type:
boolean
- Default: true
If set to true rspec will be run with --fail-fast meaning that execution will stop after first failed test is encountered (great to use in combination with running only failed tests)
- Type:
boolean
- Default: false
The extension currently only supports rspec but should eventually support the most popular test runners.
cmd-shift-p railsTestRunner.runAllTestsInFile
Or select the option via the context menu
cmd-shift-p railsTestRunner.runTestAtLine
Or select the option via the context menu
cmd-shift-p railsTestRunner.runLastTests
Right click on folder in explorer menu and select Rails Test Runner: Run all tests in folder
cmd-shift-p railsTestRunner.runAllTests
For this to work you need to also configure your rspec setup to support saving the last failures to a text file. Please take a look at: https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
After that is done simply run the command and you should only be running failed tests.
cmd-shift-p railsTestRunner.runLastFailedTests
To change your keyboard shortcuts, paste the rules in Code -> Preferences -> Keyboard Shortcuts -> keybindings.json
:
{
"key": "cmd+shift+f",
"command": "railsTestRunner.runAllTestsInFile"
},
{
"key": "cmd+shift+l",
"command": "railsTestRunner.runTestAtLine"
},
{
"key": "cmd+shift+y",
"command": "railsTestRunner.runLastTests"
},
{
"key": "cmd+shift+r",
"command": "railsTestRunner.runLastFailedTests"
},
- Support rspec
- Support minitest
- Support cucumber