GithubHelp home page GithubHelp logo

pallinder / rails-test-runner Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 12.0 1.71 MB

Extension for Visual studio code to run your specs from within vscode

TypeScript 100.00%
ruby-on-rails vscode-extension rspec-rails rspec

rails-test-runner's Introduction

Rails Test Runner README

Run your rails tests smoothly from within Visual Studio Code

Quickly run your tests

Commands

Run them through menus as well

Menu

Project goal

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.

Features

The extension currently only supports rspec but should eventually support the most popular test runners.

Configuration

railsTestRunner.rspecCommand

Configures what command will be used to execute the tests

  • Type: string
  • Default: bundle exec rspec

railsTestRunner.clearTerminal

If set to true (default) the terminal will be cleared on each new run.

  • Type: boolean
  • Default: true

railsTestRunner.focusTerminal

If set to true (default) the terminal will be focused when a test run is being initiated

  • Type: boolean
  • Default: true

railsTestRunner.railsTestRunner.rspec.failFast

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

Features

The extension currently only supports rspec but should eventually support the most popular test runners.

Run all tests in the currently opened file

cmd-shift-p railsTestRunner.runAllTestsInFile

Or select the option via the context menu

Run tests on current line

cmd-shift-p railsTestRunner.runTestAtLine

Or select the option via the context menu

Run last test(s)

cmd-shift-p railsTestRunner.runLastTests

Run all tests in current folder

Right click on folder in explorer menu and select Rails Test Runner: Run all tests in folder

Run all tests

cmd-shift-p railsTestRunner.runAllTests

Run only failing tests

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

Keybindings

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"
},

Todo

  • Support rspec
  • Support minitest
  • Support cucumber

rails-test-runner's People

Contributors

freshchris01 avatar malt03 avatar pallinder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rails-test-runner's Issues

Environment issue when using rbenv.

So the workaround I've found when having multiple ruby versions installed (OS X) with rbenv is to set the runner command like this:

{
    "railsTestRunner.rspecCommand": " /Users/me/.rbenv/shims/ruby bin/rails test"
}

Any other way to get VS Code to use the correct shell environment when running this or other Tasks?

Doesn't work anymore

Great extension but freeze on terminal for a month now. Related to VsCode update i would guess.

Run test in external terminal

Hi,

Thanks for your extension, I'd really appreciate to be able to get it to run the specs in iTerm, any idea how I might be able to configure rails-test-runner to do so please?

Best,

Romain

Customize the command when running the tests

Would be nice to customize the way that we wanna run the tests.

In my case, I've been using bin/rspec path_to_the_test instead of bundle exec rspec path_to_the_test.

We could have the default as bundle exec rspec, but that could be customizable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.