noku / rails-run-spec-vscode Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Code Extensions for running spec files
License: MIT License
Visual Studio Code Extensions for running spec files
License: MIT License
command-shift-t undoes the last closed tab, and this plugin overwrites it, with no way to undo the mapping except to manually fix the original mapping and remap a new key command
If you need to run rake test
instead of rails test
or rspec
, you need to pass the test name and it doesn't work with line numbers (which btw is not the best practice since you can move line numbers when writing tests).
Is there any trick that we can use when setting the property Ruby: spec command
in the extension's options?
I have a spec in this file: spec/features/some_spec/some_thing.rb
Header of the file:
require 'spec_helper'
feature 'some feature spec', type: :feature, js: true do
None of the runner commands work in this file. No errors. Just nothing happens.
After update to vs code 1.51.0 I observed the following:
cmd + l
isn't doing anything
cmd + shift + t
isn't doing anything
cmd + y
still works
Thanks for your hard work, this extension has made my workflow so smooth. I don't have any experience developing vs code extensions. It could be user error, but I have tried modifying the key mappings and made sure there were no conflicting key mappings. Let me know if there are any trouble shooting steps I can try.
Cheers!
Hi ๐, thanks for the gem I use it everyday and it's very convenient.
One thing I miss from Rubymine is being able to open the spec file if I am looking at the implementation and vice-versa.
For example:
app/models/foo.rb
spec/models/foo_spec.rb
The opposite should also work.
Thanks ๐
After VSCode implemented microsoft/vscode#92100. The focus always goes to terminal even with "ruby.specFocusTerminal": false
.
My current workaround is setting "ruby.specClearTerminal": false
but this is not the best solution.
The command >Run file Spec
has bit of a problem lib directories. It removes the word lib from the file path. The file that it is going to test is called lib/external/client.rb
What the command above gives me
$ bundle exec rspec spec/external/client_spec.rb
What the command should look like
$ bundle exec rspec spec/lib/external/client_spec.rb
Hey, I love using this extension on my Mac for work! It's amazing!
But on my home PC I've starting developing as well... and let's just say using the 'Windows' key on a keyboard shortcut is not ideal.
Name | Description | Keyboard Shortcuts | Menu Contexts |
---|---|---|---|
extension.runAllSpecFiles | Run All Spec Files | Windows+R | ย |
extension.runFileSpecs | Run File Specs | Shift+Windows+T | ย |
extension.runSpecsFromMenu | Run Specs | ย | explorer/context |
extension.runSpecLine | Run Spec Line | Windows+L | ย |
extension.runLastSpec | Run Last Spec | Windows+Y |
'Windows' + L locks the device... 'Windows' + R opens 'run.exe'... 'Shift' + 'Windows' + T highlights the Windows button on the Taskbar.
Am I missing something for custom keybindings? I thought I looked through the settings fully.
If I didn't, any chance that can get added?
Thanks!
I was looking for a plugin similar to RubyTest for Sublime Text or Atom RubyTest but to use within VSCode. Both of these seem to work fairly similarly but give some control over the type of test and commands being executed.
The biggest thing seems to be the fact that I don't use RSpec but instead the out of the box testing with Rails (ActiveSupport::TestCase, etc.)
Have you given any thought to supporting anything other than RSpec?
Using the newly introduced VSCode workspaces, when using CMD+L
, the terminal opens to the correct root directory, but the path to the spec also contains the root directory, so the spec file doesn't load.
For example, I have a workspace with two root folders:
If I have feature.spec.rb
open, and go to run the specs, the terminal opens to ~/.../Root2/
, and the path for the spec file will be Root2/spec/feature.spec.rb
. Instead, it should be spec/feature.spec.rb
.
I have tried to reference bin/rspec so spring is pre-loaded. However it does not evaluate this correctly and the command line results as $ [object Object] spec
ruby.specCommand": {
"type": "string",
"default": "bin\/rspec",
"description": "Defines a custom command to run for specs (i.e. 'spring rspec')"
}
Hello!
Here is the sending of clear command. But it sends it to current terminal. If I work with two or more terminals it is very bad not to control clearing.
Thank you
An attempt to run specs for a dir from File Explorer (last item in the contextual menu)
leads to the following error
[2021-11-11 12:35:38.376] [exthost] [error] TypeError: Cannot read property 'fsPath' of undefined
at /Users/vittorius/.vscode/extensions/noku.rails-run-spec-vscode-0.1.4/out/src/extension.js:19:46
at S._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:120585)
at S.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:121023)
at c._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:12743)
at c._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:12435)
at c._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:11097)
at c._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:9900)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:8004
at d.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1726)
at h.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15777)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:29836
at d.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1726)
at h.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15777)
at r._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:21035)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17921
at d.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1726)
at u.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:13138)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12486
at Socket._ (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:13107)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) extension.runSpecsFromMenu
As above, so when it tries to run the spec file it can't find it.
Even if I configure Iterm
as the default console in VS code (that it works) the extension open anyway the build in console.
Anyway great extension! thanks so much!
This started occurring after upgrading to VS Code 1.10.1 (Mac) when I execute the Run File Specs command. There is no output in Debug Console or Output -> Extensions. Having the terminal window open in advance doesn't help either.
I'm guessing this is related to terminal window changes in the latest release of VS Code.
errors after launch extension (debug)
file: 'file:///Users/another/opensource/rails-run-spec-vscode/src/terminal.ts'
severity: 'Error'
message: 'Property 'onDidCloseTerminal' does not exist on type 'typeof window'.'
at: '9,15'
source: 'ts'
i think, this error because of different versions vscode package
which version are you using?
Currently this plugin always changes focus from editor to terminal.
I often run spec per change, so I prefer not steeling focus.
Anyway, thanks for nice plugin..!
Using VS Code on Windows, with the development environment running in Docker.
User setting:
"ruby.specCommand": "docker-compose run -e 'RAILS_ENV=test' web rspec"
When running the "run line" command, I get:
An error occurred while loading ./spec\graphql\types\user_spec.rb.
Failure/Error: load file
LoadError:
cannot load such file -- /oryxapi/spec\graphql\types\user_spec.rb
Note the mixed slashes there -- this should all be forward slashes, but since Windows uses backslash, those just get piped through and I believe they confuse the Docker instance trying to run the tests.
Is there a way to convert those backslashes to slashes?
add ability of run specs for folder. I think it is necessary function :)
Rspec lets you run tests with rpec test/spec.rb -e 'name of test'
where name of test
is some subset of the test string. This can be very useful for when you're refactoring tests, and the line number moves around. Is this something you think would work in this project? I might try exploring a pull request if you approve it @noku
Dear extension author,
Please publish this extension to the Open VSX marketplace.
Unfortunately, as Microsoft prohibits usages of the Microsoft marketplace by any other products or redistribution of .vsix
files from it, in order to use VS Code extensions in non-Microsoft products, we kindly ask that you take ownership of the VS Code extension namespace in Open VSX and publish this extension on Open VSX.
Open VSX is a vendor neutral alternative to the MS marketplace used by most other derivatives of VS Code like VSCodium, Gitpod, OpenVSCode, Theia-based IDEs, and so on.
You can read on about Open VSX at the Eclipse Foundation's Open VSX FAQ.
The docs to publish an extension can be found here. This process is straightforward and shouldn't take too long. Essentially, you need an authentication token and to execute the ovsx publish
command to publish your extension. There's also a doc explaining the whole process with an example GitHub Action workflow.
I often forget to save the current file (code or spec file) before using the keyboard shortcuts to run the spec(s) - would u consider a feature which first automatically saves the current file?
Hi,
first of all thanks for making this extension, it saved me a lot of time.
I have a problem with the tasks since I upgraded vscode to 1.23:
Right after I ran one of the tasks, the integrated console shows me my prompt at the top of the window, so I cannot see the results of the tests.
Could be that I have some misconfiguration here. I can provide my config if necessary.
Thanks for the help,
Nick
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.