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

Jasmine test runner isn't available: Connection refused - connect(2) #103

Closed
drewB opened this issue Jan 22, 2013 · 16 comments
Closed

Jasmine test runner isn't available: Connection refused - connect(2) #103

drewB opened this issue Jan 22, 2013 · 16 comments

Comments

@drewB
Copy link

drewB commented Jan 22, 2013

When I run guard I keep getting:

Jasmine test runner isn't available: Connection refused - connect(2)

I don't get any errors when I manually start the jasmine server (rake jasmine). If I start the jasmine server before running guard then I get:

An error occurred: Timeout waiting for the Jasmine test results!
> [#17488A8AB5C9] 
> [#17488A8AB5C9] Jasmine 1.2.0 revision 1337005947
> [#17488A8AB5C9] 

Below is my guard statement:

guard 'jasmine', :jasmine_url => 'http://localhost:8888/', :server_timeout => 120 do
    watch(%r{spec/compiled_javascripts/spec\.(js\.coffee|js|coffee)$})         { "spec/compiled_javascripts" }
    watch(%r{spec/compiled_javascripts/.+_spec\.(js\.coffee|js|coffee)$})
    watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$})  { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
end

guard-jasmine-debug http://localhost:8888/ doesn't give any additional info.

Any help you can give would be much appreciated.

@netzpirat
Copy link
Contributor

You need to set the port manually if you set a jasmine url, because the port isn't extracted from the url, instead a random one is searched:

guard 'jasmine', :server => :jasmine_gem, :port => 8888, :jasmine_url => 'http://localhost:8888/', :server_timeout => 120 do
    watch(%r{spec/compiled_javascripts/spec\.(js\.coffee|js|coffee)$})         { "spec/compiled_javascripts" }
    watch(%r{spec/compiled_javascripts/.+_spec\.(js\.coffee|js|coffee)$})
    watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$})  { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
end

@drewB
Copy link
Author

drewB commented Jan 23, 2013

I still seem to get the same errors after adding the port.

guard 'jasmine', :server => :jasmine_gem, :jasmine_url => 'http://localhost:8888/', :port => 8888, :server_timeout => 120 do

@netzpirat netzpirat reopened this Jan 23, 2013
@netzpirat
Copy link
Contributor

After you have started Guard, does the Jasmine runner work at the given url?

@drewB
Copy link
Author

drewB commented Jan 23, 2013

hitting the url http://localhost:8888/ does work (which it didn't before).

@netzpirat
Copy link
Contributor

Does starting Guard::Jasmine manually after Guard has started work?

19:07:05 - INFO - Guard::Jasmine starts Unicorn test server on port 8888 in development environment.
19:07:06 - INFO - Waiting for Jasmine test runner at http://localhost:8888/jasmine
19:07:15 - INFO - Guard is now watching at '/Users/michi/Repositories/myproject'
[1] guard(main)> jasmine
19:08:24 - INFO - Run Jasmine
19:08:24 - INFO - Run all Jasmine suites
19:08:24 - INFO - Run Jasmine suite at http://localhost:8888/jasmine
19:08:29 - INFO - Finished in 0.732 seconds
19:08:29 - INFO - 251 specs, 0 failures
19:08:29 - INFO - Done.
[2] guard(main)> 

@drewB
Copy link
Author

drewB commented Jan 23, 2013

And the different URLs it tries for each spec are valid URL. I have never used jasmine outside of a headless environment so not entirely sure what it should look like (I am switching for jasmine-webkit-headless) but it seems to be a bunch of dashes which I assume is simulating green dots.

@drewB
Copy link
Author

drewB commented Jan 23, 2013

I get the same error when I run jasmine manually in Guard.

@netzpirat
Copy link
Contributor

I do not use the Jasmine gem in any of my projects, so it's hard to tell what the problem is. I always use it in the asset pipeline and for projects that are not a Rails app, I just define a mini Rails app just for the Jasmine specs, because I like to have Sprockets to handle all the dependencies. You can have a look at the Haml Coffee Assets project for the complete spec setup.

@carhartl opened an issue 5 days ago about running the Jasmine gem on Travis CI and he said the Jasmine gem works fine for him locally. So I suppose it's a configuration issue in your setup.

@drewB
Copy link
Author

drewB commented Jan 23, 2013

In case it wasn't explicit, adding the additional params to the guard statement did fix the problem of the jasmine server coming up. Might be good to clarify that in the README. I was following the instructions in the non-asset pipeline section.

I just pointed to the jasmine server and looked in the console and see a bunch of dependancy errors, so that is likely what is causing my current problem.

@netzpirat
Copy link
Contributor

Oh I see! The docs are outdated because of the introduction of random server ports in #89! That is fixed now. I will release a new version that contains #102 when all Travis specs are passing. Thanks for reporting your issue.

@netzpirat
Copy link
Contributor

1.12.0 is out that uses the correct jasmine url for the Jasmine gem if you do not specify the port and jasmine_url option.

@drewB
Copy link
Author

drewB commented Jan 23, 2013

Thanks for you help.

@carhartl
Copy link
Member

So when I use the jasmine_gem server I do no longer have to specify jasmine_url and port option?

@netzpirat
Copy link
Contributor

Yes, it should work out of the box now.

@carhartl
Copy link
Member

Yes, it does. Thanks, awesome, removed the duplication 👍

@drewB
Copy link
Author

drewB commented Jan 23, 2013

I discovered what the other problem was. I had a bad character in one of my Coffeescript specs which was causing the jasmine runner to die with a NOT_FOUND_ERR: DOM Exception 8. I put a break point in where it was breaking and tracked it to the bad spec.

it 'should get the selectedOptionValue': ->

instead of

it 'should get the selectedOptionValue', ->

Notice the semi-colon instead of comma.

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

3 participants