moxley / atom-ruby-test Goto Github PK
View Code? Open in Web Editor NEWRun Ruby tests, Rspec examples, and Cucumber features from Atom
License: MIT License
Run Ruby tests, Rspec examples, and Cucumber features from Atom
License: MIT License
for some reason, when the package runs:
ruby -I test {relative_path}
i get a cannot load such file
error, but if i manually set the following in the configuration:
ruby -I test /path/to/my/test/folder/{relative_path}
it works.
any ideas how to make relative pathing work, or grab absolute path from the environment?
best,
tony.
Is it possible to restore the default keybindings?
After updating to 0.9.14, the keybindings invoked each function twice. So cmd-ctrl-t opened two test windows running the tests twice. I opened the ruby-test settings and unchecked "enabled keybindings". Now that option is gone so I cannot check it. I've tried reinstalling ruby-test.
I am using an old version of ruby (REE 1.8.7
) and cucumber (0.10.5
). In order to get coloured output, I had to set the cucumber commands like follows:
'ruby-test':
'cucumberSingleCommand': 'cucumber --color {relative_path}:{line_number}'
'cucumberFileCommand': 'cucumber --color {relative_path}'
'cucumberAllCommand': 'cucumber --color features'
I am not sure if including this option hardcoded could cause some issues with newer versions. Otherwise, at least we could include this information in the documentation, so users like me could find this information easily and have a better experience with the plugin.
Congratulations for this nice package,
Carlos.
This is pretty important. I want to copy a value in the output and paste it somewhere. Or I want to copy the test file path and paste it into a terminal.
Markdown Preview has recently added the ability to copy text from the preview pane. Maybe use whatever technique they're using. Here's the function that does it: https://github.com/atom/markdown-preview/blob/c14e5c7ac912c0ebd08224d2c501a2680a32f3ec/lib/markdown-preview-view.coffee#L153
I get this error if I use ctrl-shift-Y, ctrl-shift-T or ctrl-shift-R.
My project uses Rspec and has a valid Gemfile at its root, and I've changed the command in settings to use "bundle exec rspec" instead of just "rspec".
I also use rbenv, in case that's relevant.
[Enter steps to reproduce below:]
Atom Version: 0.196.0
System: Mac OS X 10.10.3
Thrown From: ruby-test package, v0.9.6
Uncaught TypeError: undefined is not a function
At /Users/matt/.atom/packages/ruby-test/lib/source-info.coffee:32
TypeError: undefined is not a function
at SourceInfo.module.exports.SourceInfo.currentLine (/Users/matt/.atom/packages/ruby-test/lib/source-info.coffee:34:36)
at TestRunner.module.exports.TestRunner.command (/Users/matt/.atom/packages/ruby-test/lib/test-runner.coffee:33:48)
at TestRunner.command (/Users/matt/.atom/packages/ruby-test/lib/test-runner.coffee:1:1)
at TestRunner.module.exports.TestRunner.run (/Users/matt/.atom/packages/ruby-test/lib/test-runner.coffee:15:28)
at RubyTestView.module.exports.RubyTestView.runTest (/Users/matt/.atom/packages/ruby-test/lib/ruby-test-view.coffee:72:13)
at RubyTestView.module.exports.RubyTestView.testFile (/Users/matt/.atom/packages/ruby-test/lib/ruby-test-view.coffee:53:6)
at atom-workspace.<anonymous> (/Users/matt/.atom/packages/ruby-test/lib/ruby-test-view.coffee:24:68)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/src/command-registry.js:238:29)
at /opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:519:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:354:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:178:20)
-0:16.9.0 core:close (atom-text-editor.editor.is-focused)
-0:06.0 fuzzy-finder:toggle-file-finder (atom-pane.pane.active)
-0:03.2.0 core:move-down (atom-text-editor.editor.mini)
-0:03.0 core:confirm (atom-text-editor.editor.mini)
-0:01.6.0 ruby-test:test-file (atom-text-editor.editor.is-focused)
{
"core": {
"themes": [
"seti-ui",
"seti-syntax"
],
"disabledPackages": [
"racer"
]
},
"ruby-test": {
"rspecAllCommand": "bin/rspec --tty spec",
"rspecSingleCommand": "bin/rspec --tty {relative_path}:{line_number}",
"rspecFileCommand": "bin/rspec --tty {relative_path}"
}
}
# User
autocomplete-plus, v2.12.1
autocomplete-ruby, v0.1.0
language-rust, v0.4.3
linter, v0.12.1
linter-rubocop, v0.2.3
pretty-json, v0.3.3
ruby-bundler, v0.2.1
ruby-test, v0.9.6
seti-syntax, v0.4.0
seti-ui, v0.6.3
test-jumper, v0.3.0
# Dev
No dev packages
I have a minitest spec file that contains a method definition. ruby-test
now thinks the file is an rspec file, and tries to run the rspec test run command.
When I'm viewing a .feature file and I run Ruby Test: Test File (or any other Ruby Test command) it tries to run the feature using rspec instead of cucumber.
I'm down to take a stab at this if you can point me in the right direction.
Any workaround?
Unsupported use of '&&'. In fish, please use 'COMMAND; and COMMAND'.
fish: cd /Users/X/project && bundle exec rspec spec/models/user_spec.rb; exit
atom-ruby-test colours are very hard to look when using Solarized colour theme. I mean solarized has its red colour which looks nice. atom-ruby-test uses different red combinded w/ lighter background that makes output very hard to read. Example screenshot attached.
Below is example of Solarized theme's red:
Would it be possible to better match colours defined in Theme?
There are a few problems that prevent this tool from working with fish.
First of all, the order of ['-c', '-l', testCommand]
in shell-runner.coffee is incorrect for fish, and, according to the man page, for bash. Interesting that it seems to work in bash.
-c
is supposed to accept a string; the command to run in the shell. Placing it before -l
passes -l
as the command to run, which is not the intent.
The second problem is, fish does not use &&
to run multiple commands. It uses ;
instead.
These changes seem pretty simple, and the only reason I have not created a PR with them is I wanted to know if you had any objections to this.
For reference: https://github.com/postmodern/chruby. I installed on OSX using Homebrew, FWIW.
I setup my test/rspec commands to use bin/rspec --tty
(etc.). When I run any of the tests (cmd-ctrl-r, for example), I get output in the console saying that it can't find bundler--but the ruby path that's in the backtrace is for the system ruby. (As an aside, and I don't know if this is on you or Atom, it'd be nice to be able to copy the output from the console so I can paste in here. I'm not able to select anything in there). I've tried changing the commands to look like:
bin/rsepc --tty spec
bundle exec rspec --tty spec
source /usr/local/opt/chruby/share/chruby/chruby.sh; cd .; bundle exec rspec --tty spec
Atom version: 0.115.0
Ruby test: 0.7.0
When using Atom with multiple directories open, ruby-test uses the wrong path for files. It seems that it always use the first directory root path.
After updating to 0.9.8 rspec files are running by commands for minitest files.
Convert ANSI colors from the test command output into HTML colors.
In ruby test
for Sublime Text, test runs jump over debug
or byebug
statements and finish execution. In Atom, the code stops (I have verified this behavior for byebug
only).
I cannot find a way to resume. Of course the best would be if there were a way to actually step through code from Atom, but failing that, ruby test
runs should not freeze on these statements.
UPDATE: Indeed when ruby-test
stops on a byebug
statement, there's no apparent way to kill it without closing Atom.
When there is no test file open, and there exists a spec
directory in the project, and the user executes the test-all ruby-test command, ruby-test ignores a specFramework
setting set to "minitest" and assumes the framework is rspec.
This user had a space in one of the directory names leading up to their project directory. It caused an error in the test output: zsh:cd:1 string not in cwd...
.
See #29.
There should be some way to cancel the current test run, probably CTRL-C
and also CMD-CTRL-X
I have searched high and low to get the plugin working with RBENV or RVM and have come up short. I know that the docs say that they are supported, but is there anything that needs to be done to enable the support.
Here is an example of what I am running into: http://cl.ly/image/0u0L22171J3Z
Which means that the plugin is trying to use system ruby.
What I have tried: add rbenv to bash (I currently use zsh). which doesn't seem to help at all.
Any pointers would be greatly appreciated and from what I find I will add to the documentation so that others don't run into the same issue 😄
This is my code:
def multiples
vals = Array.new
vals = multiples
(1..999).each do |i|
if i % 3 == 0 && if i % 5 == 0
puts i
end
end
end
multiples
Not sure why it is not wanting to compile the code. Any suggestions?
so i recently got a new macbook and trying to re-create my environment.
installed atom and this package fresh, and when i go to settings page,
it only shows the key-bindings section, but not the settings section
(where you can enter 'test all command', etc...):
atom: 0.177.0
ruby-test: 0.9.4
osx: 10.9.5
any suggestions for troubleshooting?
best,
tony.
I am new to Atom and therefore dont know whether this is a platform limitation or not. When a test or suite of ruby tests are run there is no output until the final tests are shown even though the output eventually includes the progress dots and feedback. This means that for a test suite that takes a period of time to complete there is no immediate feedback. I have run the tests by using the keymap bindings, e.g.
Atom version 0.211.0, ruby-test version 0.9.11.
Running oh-my-zsh, and notice that my ~/.zshrc
isn't loaded automatically, which causes the PATH to not be set, so gems like rspec
and bundler
aren't available.
The only way I could get it working was to explicitly source my ~/.zshrc
(see screenshot below), which obviously is not ideal. Not sure if something is misconfigured on my end, or if this is a legitimate bug.
When trying to run my tests I received some output stating that I should use bundle exec
to run the tests. I manually edited the package and added bundle exec
and now the tests work for me.
I'm not totally sure if adding bundle exec
as a prefix to all commands will have the expected outcome for people who are not working inside of a bundle. What do you think?
I could possibly spend some more time on this and add bundle support as a setting.
Normally I'd expect the escape key to close the Ruby Test pane, similar to how the Find and Replace pane disappears when pressing Escape.
From the Atom deprecation cop:
atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please useatom.views.getView(atom.workspace)
,
which returns an HTMLElement.Atom.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/src/atom.js:55:11) RubyTestView.initialize (/Users/keiter/.atom/packages/ruby-test/lib/ruby-test-view.coffee:20:9)
Uncaught TypeError: Cannot read property 'save' of undefined
Atom Version: 0.158.0
System: Mac OS X 10.9.5
Thrown From: ruby-test package, v0.9.1
(On Mac)
Note: No file is open
At /Users/enri8294/.atom/packages/ruby-test/lib/ruby-test-view.coffee:61
TypeError: Cannot read property 'save' of undefined
at RubyTestView.module.exports.RubyTestView.runTest (/Users/enri8294/.atom/packages/ruby-test/lib/ruby-test-view.coffee:61:37)
at RubyTestView.module.exports.RubyTestView.testFile (/Users/enri8294/.atom/packages/ruby-test/lib/ruby-test-view.coffee:46:6)
at atom-workspace.<anonymous> (/Users/enri8294/.atom/packages/ruby-test/lib/ruby-test-view.coffee:21:59)
at atom-workspace.handler (/Applications/Atom.app/Contents/Resources/app/src/space-pen-extensions.js:115:32)
at atom-workspace.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4681:9)
at atom-workspace.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4359:46)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:243:29)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:156:19)
at Ipc.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:65:30)
at Ipc.emit (events.js:107:17)
at process.<anonymous> (/Applications/Atom.app/Contents/Resources/atom/renderer/api/lib/ipc.js:22:29)
at process.emit (events.js:110:17)
/cc @atom/core
When running Ruby Test: Single File
the output window shows:
/Users/brian/.rvm/scripts/extras/bash_zsh_support/chpwd/function.sh: line 5: cd: atom://config: No such file or directory
In shell_runner.full_command I added alert(this.params.cwd())
which pops up an alert with atom://config
No spaces in the project path (though there are dashes). Atom v1.0.0. OSX.
Do you have a plan to support the Scratch feature.
It's comfortable to use.
See below
Hi! I'm loving ruby-test and it works perfectly inside my spec files. However, when I run it inside my feature files for cucumber tests, I noticed it was still trying to run the rspec
command. I had changed the default settings to just include the bundle exec
command, but even when I changed everything back to default, my feature tests were still being run with Rspec. Have I missed something? Can I provide any other information? I just downloaded the newest Atom 1.0.0 version a couple days ago and my ruby-test version is 0.9.11, which looks like the newest.
I've attached an image so you can see what it's saying in the test panel - that it's trying to run rspec with a feature file. The error it gives is that it sees ':' instead of 'end' - obviously because it's trying to run Rspec.
Thank you in advance!
Related to #6
When clicking on a filename, ex. test.rb:52
, in the output pane, that file should be opened and the cursor moved to that line.
RSpec
allows rails_helper
or spec_helper
to be required by default through configuration of the .rspec
file:
--color
--require rails_helper
Therefore, atom-ruby-test
mistakes RSpec
specs for Minitest
specs when the require is omitted because it uses this RegExp
:
rspecRequireRegExp = new RegExp(/^require(\s+)['"](rails|spec)_helper['"]$/)
Use TextEditor::getLastCursor() instead
TextEditor.getCursor (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:2940:7)
SourceInfo.currentLine (/Users/ccschmitz/.atom/packages/ruby-test/lib/source-info.coffee:34:35)
Use TextEditor::getLastCursor() instead
TextEditor.getCursor (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2990:7)
SourceInfo.currentLine (/Users/kematzy/.atom/packages/ruby-test/lib/source-info.coffee:34:35)
TestRunner.module.exports.TestRunner.command (/Users/kematzy/.atom/packages/ruby-test/lib/test-runner.coffee:33:47)
command (/Users/kematzy/.atom/packages/ruby-test/lib/test-runner.coffee:1:0)
I'm developing with Atom on a 27" display, and having the test-result pane span over the complete width of the window seems like a bit too much. I tried to think of a way to do this differently, but couldn't really come up with anything else, except for maybe an implementation like suggested in #1 (when the results are put in a tab, we should be able to move them around with the default keyboard shortcuts).
So I thought I'd at least create this issue to see if other people have put any thought into this.
When switching between multiple projects, it is a pain to reconfigure ruby-test. My day job Ruby projects are hosted in a Vagrant VM, and ruby-test needs special configuration to issue commands to the VM. Other Ruby projects run on the native machine and use the default configuration. Switching back and forth requires saving the old configuration in a copy-paste fashion, one line at a time from the ruby-test settings to a text file, then restoring the configuration, one line at a time when I switch back to the other project.
Ability to click on a file path in the output and have it open in the editor.
I believe this is a caused by the discrepancy between buffer and screen coordinates. I will dig into this more tomorrow to see if I can figure out more.
Hey I love the this Atom package for the simplicity and ease-of-use.
I am always looking for ways to speed up my development process.
I started using the Spring preloader for a recent Rails project I am working on. This makes the test run without any startup time from the commandline like this:
spring rake
Within this plugin I can see it runs (for single test) a command looking like this example: ruby -I test test/controllers/comments_controller_test.rb
Is it possible to also use the spring preloader from inside atom-ruby-test?
If so, how should I modify the commands?
[Enter steps to reproduce below:]
Atom Version: 0.182.0
System: Mac OS X 10.10.2
Thrown From: ruby-test package, v0.9.5
Uncaught TypeError: Cannot read property 'replace' of undefined
At /Users/aehrmann/.atom/packages/ruby-test/lib/test-runner.coffee:32
TypeError: Cannot read property 'replace' of undefined
at TestRunner.module.exports.TestRunner.command (/Users/aehrmann/.atom/packages/ruby-test/lib/test-runner.coffee:32:10)
at TestRunner.command (/Users/aehrmann/.atom/packages/ruby-test/lib/test-runner.coffee:1:1)
at TestRunner.module.exports.TestRunner.run (/Users/aehrmann/.atom/packages/ruby-test/lib/test-runner.coffee:15:28)
at RubyTestView.module.exports.RubyTestView.runTest (/Users/aehrmann/.atom/packages/ruby-test/lib/ruby-test-view.coffee:66:13)
at RubyTestView.module.exports.RubyTestView.testAll (/Users/aehrmann/.atom/packages/ruby-test/lib/ruby-test-view.coffee:53:6)
at atom-workspace.<anonymous> (/Users/aehrmann/.atom/packages/ruby-test/lib/ruby-test-view.coffee:25:67)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:243:29)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:558:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:396:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:176:20)
-3:57.4 core:move-down (atom-text-editor.editor.mini)
-3:57.2 core:confirm (atom-text-editor.editor.mini)
-3:57.2 rspec:run-all (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-monokai.theme-one-dark-ui)
-3:14.8 settings-view:open (atom-pane.pane.active)
-3:09.2 core:confirm (atom-text-editor.editor.mini)
-3:06.8 editor:delete-to-beginning-of-word (atom-text-editor.editor.mini)
-3:05.0 core:confirm (atom-text-editor.editor.mini)
-2:58.6 core:backspace (atom-text-editor#ruby-test.rspecAllCommand.editor.mini)
-2:47.5 core:close (div.settings-view.pane-item)
-2:45.9 emmet:evaluate-math-expression (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-monokai.theme-one-dark-ui)
-2:42.7 core:close (atom-pane.pane.active)
-2:36.1 ruby-test:test-all (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
-0:41.0 settings-view:open (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-monokai.theme-one-dark-ui)
-0:35.4 core:confirm (atom-text-editor.editor.mini)
-0:02.2 pane:show-previous-item (div.settings-view.pane-item)
-0:00.9 ruby-test:test-all (atom-text-editor.editor.is-focused)
{
"core": {
"themes": [
"one-dark-ui",
"monokai"
],
"disabledPackages": [
"language-objective-c",
"archive-view",
"autosave",
"whitespace",
"rspec"
]
},
"ruby-test": {
"rspecAllCommand": "rspec",
"shell": "zsh"
}
}
# User
atom-beautify, v0.21.3
autocomplete-plus, v2.1.6
color-picker, v1.4.4
emmet, v2.3.3
git-plus, v4.4.8
highlight-line, v0.9.3
monokai, v0.12.0
ruby-test, v0.9.5
# Dev
No dev packages
After double-clicking the resize handle, I can't seem to restore the height of the output pane.
I've tried double-clicking it again, but it stays minimized.
Am I doing something wrong?
Thanks in advance!
trying to use cmd-ctrl-r (run test at cursor) with minitest and it doesn't like the file:line-number
syntax (i even tried the m
gem but there is an issue with that and the current version of minitest).
using:
ruby -I test {relative_path} --name {test_name}
would work, but it would need to parse out the quoted string at the cursor, snake_case it and prefix with test_
, for example:
test 'should create with valid creds' do
would yield test_should_create_with_valid_creds
i'm an atom package developer noob, but i'd be willing to help out if you are stretched.
regards,
tony.
When first installing the package, the settings are not available to configure. They will not show up until Ruby Test is activated via one of the activation commands, like "toggle", "test-all", "test-file", etc.
I'm not sure the solution for this, other than activating the package when the editor starts up, which adds to the startup time. Ideally, Atom would activate the package when opening the package's settings page.
In SublimeText I was able to show the test results on tab rather than on a panel below.
Any chance that could work with Atom?
The output of the tests might be long; especially when there are failing :p
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.