-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run single test file with spring: true
set
#130
Comments
Sorry some digging has traced this back to some local changes to the rake test task. |
@chrisnicola I haven't made any local changes to the test rake task but I do have the same issue. Could you please share what you've done to make it work as expected? |
I can't recall, but I believe we had customized the task to run some extra test folders and there was a mistake. |
@richardvenneman did you ever resolve your problem? I'm having the same issue as well. |
@gshaw - run guard with the Then, the next step would be to run that exact command outside Guard. |
@e2, I did. When you run with When
When
If only one file is passed when The problem is that I'm not sure how to pass multiple tests to |
@gshaw - I'm not a minitest user (too frustrating in my experience), but I might have a few hints:
Then it isn't a Guard::Minitest issue. Not until the problem is understood in a way where Guard::Minitest can help.
I believe it should go something like this: (Though I'm not sure how minitest handles So it's running all the tests because you're not setting the It's just that minitest expects environment variables, not arguments, e.g. I'm also not sure about how forking plays here. With forking environment variables are usually that of the original process (e.g. spring in this case), unless they're set manually somewhere. Add some |
If it's a bug in how |
OK, it took a bit of looking but the problem I believe is how Rails 5 is favoring guard "minitest", spring: "bin/rails test" do
...
end It might be a good idea to check for Rails 5 and use by default |
@gshaw - that makes sense, since Rake uses/handles arguments differently. Rails should already be activated as a gem, so detection is possible - Guard pretty much tries to use bundler if possible. Though minitest autoloads plugins through rubygems - so that would take testing. So testing for Rails in activated gems could be enough. Another idea is the new Rails 5 API - lots has changed on the testing side, so it's possible to just reference classes/methods new in Rails 5 (e.g. railties related to testing). Does the TEST= variable work for multiple files? If so, then maybe just the command-line can be changed, so that spring+rake to compose the TEST= parameter? |
The At least for now adding a conditional to https://github.com/guard/guard-minitest/blob/master/lib/guard/minitest/runner.rb#L166 to check if Rails 5 is activated and if so use I'd save the deeper integration with the Rails 5 API at least until the final version is out and then only if there is a real need for the extra coupling. |
I think a better patch is to not be Rails-5 "aware", but to actually compose the TEST= parameter, e.g. replacing: https://github.com/guard/guard-minitest/blob/2db91fb/lib/guard/minitest/runner.rb#L173 with: cmd_parts + "TEST='#{paths.join(' ')}'" though I'm not sure if that will be passed down properly. |
Just want to second @e2's suggestion. I'm stuck on an older version of Rails and having this exact problem, with spring turned on it's not possible to run only one test. |
For some reason extra tests are being run whenever
spring: true
is set.With guard:
Directly:
The text was updated successfully, but these errors were encountered: