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

Problem with console.log #1

Closed
thibaudgg opened this issue Sep 8, 2011 · 11 comments
Closed

Problem with console.log #1

thibaudgg opened this issue Sep 8, 2011 · 11 comments

Comments

@thibaudgg
Copy link
Member

When I add some console.log 'stuff' in my javascripts assets I got:

Run Jasmine tests: http://localhost:3000/jasmine?spec=Period
ERROR: Guard::Jasmine failed to achieve its <run_on_change>, exception was:
MultiJson::DecodeError: 743: unexpected token at 'stuff
stuff
stuff
stuff
stuff
stuff
{
  "suites": [],
  "stats": {
    "specs": 44,
    "failures": 0,
    "time": 0.047
  }
}
'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/json_pure-1.5.4/lib/json/common.rb:148:in `parse'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/json_pure-1.5.4/lib/json/common.rb:148:in `parse'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/multi_json-1.0.3/lib/multi_json/engines/json_gem.rb:13:in `decode'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/multi_json-1.0.3/lib/multi_json.rb:65:in `decode'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine/runner.rb:108:in `evaluate_result'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine/runner.rb:30:in `block in run'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine/runner.rb:29:in `each'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine/runner.rb:29:in `inject'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine/runner.rb:29:in `run'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.0/lib/guard/jasmine.rb:62:in `run_on_change'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:106:in `supervised_task'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:84:in `block (2 levels) in run_on_change'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:80:in `each'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:80:in `block in run_on_change'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:95:in `run'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:79:in `run_on_change'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:50:in `block (2 levels) in start_reactor'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:46:in `loop'
/Users/Thibaud/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:46:in `block in start_reactor'

Guard::Jasmine has just been fired

Any ideas why? :)

@netzpirat
Copy link
Contributor

OH, shit. The console is redirected to Phantom JS and used to generate the JSON protocol to talk to Guard::Jasmine. But that's an easy fix. Stay tuned :P

@netzpirat
Copy link
Contributor

Version 0.2.1 should fix that. It filters non wanted console.log calls now.

@thibaudgg
Copy link
Member Author

now I got that one :|

Run Jasmine tests: http://localhost:3000/jasmine?spec=Period
Parse error on line 49: Unexpected ','
ERROR: Guard::Jasmine failed to achieve its <run_on_change>, exception was:
MultiJson::DecodeError: A JSON text must at least contain two octets!
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/json_pure-1.5.4/lib/json/common.rb:148:in `initialize'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/json_pure-1.5.4/lib/json/common.rb:148:in `new'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/json_pure-1.5.4/lib/json/common.rb:148:in `parse'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/multi_json-1.0.3/lib/multi_json/engines/json_gem.rb:13:in `decode'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/multi_json-1.0.3/lib/multi_json.rb:65:in `decode'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine/runner.rb:108:in `evaluate_result'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine/runner.rb:30:in `block in run'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine/runner.rb:29:in `each'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine/runner.rb:29:in `inject'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine/runner.rb:29:in `run'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-jasmine-0.2.1/lib/guard/jasmine.rb:62:in `run_on_change'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:106:in `supervised_task'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:84:in `block (2 levels) in run_on_change'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:80:in `each'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:80:in `block in run_on_change'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:95:in `run'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard.rb:79:in `run_on_change'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:50:in `block (2 levels) in start_reactor'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:46:in `loop'
/Users/Thibaud/Codes/.../vendor/ruby/1.9.1/gems/guard-0.7.0.rc1/lib/guard/listener.rb:46:in `block in start_reactor'

Guard::Jasmine has just been fired

@netzpirat
Copy link
Contributor

I should have specs for that CoffeeScript file...

@netzpirat netzpirat reopened this Sep 8, 2011
@thibaudgg
Copy link
Member Author

Works great now, thanks!

@thibaudgg
Copy link
Member Author

Hey, I got again the last MultiJson::DecodeError: A JSON text must at least contain two octets! issue with v 0.3.0.
http://localhost:3000/jasmine is all green. :(

@netzpirat
Copy link
Contributor

I don't have this problem here, works without problems and a console.log in the spec is filtered. Can give me the JSON that gets returned from the spec runner? You can retrieve if in the console by running the run_jasmine.coffee script like this:

phantomjs lib/guard/jasmine/phantomjs/run-jasmine.coffee http://localhost:3000/jasmine

@thibaudgg
Copy link
Member Author

Ok found the issue, running all the spec is ok, but when I launch just one file there is no JSON returned. I think the issue comes from calling http://localhost:3000/jasmine?spec=MyModel instead of http://localhost:3000/jasmine?MyModel (which runs fine).

@netzpirat
Copy link
Contributor

Thanks for debugging! I've pushed 0.3.1, which removes spec= from the Jasmine runner url.

@netzpirat
Copy link
Contributor

I reverted this because I found the real error: The dom extractor wanted specs (plural) on the page, but when you had a single model spec, it fails because the report contained only spec (singular). So this should now work as intended.

I hope it will be possible in PhantomJS 1.3 to inject my very own Jasmine reporter, so I don't have to extract the result from the dom. This will be much less erroneous and would allow the introduction of a stream protocol, so the results came in one by one and not all at the end.

@thibaudgg
Copy link
Member Author

I see :)

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