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

ERROR: Cannot decode JSON from PhantomJS runner: can't convert String into Integer #57

Closed
rhuelga opened this issue May 8, 2012 · 2 comments

Comments

@rhuelga
Copy link

rhuelga commented May 8, 2012

Looking around I found that the json response 'errors' have the 'trace' property wrapped around a array, so when method report_spec_errors is called in the line

Formatter.spec_failed(indent("    ➜ Exception: #{ error['msg']  } in #{ error['trace']['file'] } on line #{ error['trace']['line'] }", level))

a exception is raised cause error['trace'] is a array not a hash, and the paramenter for method [] needs to be a Integer, I solved it forcing the first element with [0]

Formatter.spec_failed(indent("    ➜ Exception: #{ error['msg']  } in #{ error['trace'][0]['file'] } on line #{ error['trace'][0]['line'] }", level))

Here is a fragment of my json response

"errors":[{"msg":"TypeError: Fake XHR onreadystatechange handler threw exception: 'undefined' is not a function",
"trace":[{"file":"http://localhost:8888/assets/sinon.js?body=1","function":"","line":567}]},
{"msg":"TypeError: Fake XHR onreadystatechange handler threw exception: 'undefined' is not a function",
"trace":[{"file":"http://localhost:8888/assets/sinon.js?body=1","function":"","line":567}]},
{"msg":"TypeError: Fake XHR onreadystatechange handler threw exception: 'undefined' is not a function",
"trace":[{"file":"http://localhost:8888/assets/sinon.js?body=1","function":"","line":567}]}]
@netzpirat
Copy link
Contributor

Oh what a stupid mistake, I used a wrong JSON response for developing this feature, wrong spec == wrong impl :P Thanks for reporting. I'll have a look at it...

@netzpirat
Copy link
Contributor

Just released 1.1.3 with a fix for the trace notifications.

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