Skip to content
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

Hangs while trying to start Jasmine server with :server => :jasmine_gem #17

Closed
dcuddeback opened this issue Dec 9, 2011 · 5 comments
Closed

Comments

@dcuddeback
Copy link
Contributor

I want to use guard-jasmine to run my tests against a vanilla Jasmine server. I configured my Guardfile with:

guard 'jasmine', :server => :jasmine_gem, :jasmine_url => 'http://localhost:8888/'

and the necessary guard-coffeescript directives above that to compile my CoffeeScript files. The problem is when I start guard, it hangs with the last line of output beging:

Guard::Jasmine starts Jasmine Gem test server on port 8888.

My Jasmine runner is not available at http://localhost:8888/ (I tried loading it in the browser). Guard is blocked at this point and can't process any events.

I can work around it by specifying :server => :none and manually launching rake jasmine before running guard. Then everything works beautifully. The JavaScript specs run really fast. It would be more convenient if :server => :jasmine_gem launched the server for me.

Let me know if you need any more info about my setup to debug this.

@netzpirat
Copy link
Contributor

Thank for reporting this. guard-jasmine uses the rack server from the Jasmine gem, so perhaps something has changed in the Jasmine gem. I'll have a look at it, but it won't happend before the next week.

@netzpirat
Copy link
Contributor

As workaround you could try this gist, which uses guard-process to start the Jasmine server.

@dcuddeback
Copy link
Contributor Author

No worries. I know people are busy this time of year. Thanks for pointing me at guard-process. That will be much better than running rake jasmine manually. If I get time this week, I'll dig into this some more to see what I find. I'm using jasmine version 1.1.2. The code you pointed me to in start_jasmine_gem_server looks like it was taken right out of the Jasmine Rake task, the only difference being that you're executing start_server in a thread. So I don't see any obvious reason why this would fail.

@dcuddeback
Copy link
Contributor Author

I figured it out. An exception was being raised but not being printed out. I wrapped the code that attempts to start the Jasmine server in a begin/rescue block and printed the exception. At first, I saw:

uninitialized constant Jasmine::Config::Rack

After requiring rack, I saw:

undefined method `app' for Jasmine:Module

Jasmine.app is definied in lib/jasmine/server.rb of the jasmine gem. Requiring jasmine at the top of the file fixed the issue for me.

@netzpirat
Copy link
Contributor

Well spotted, thank you. I have just moved the require statement into the jasmine server scope, so Rails 3.1 user won't have to add the Jasmine gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants