jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

CLI Debugging ? #109

Closed andyl closed 11 years ago

andyl commented 11 years ago

I am able to use console.log statements when running jasmine specs in the CLI and in the browser. And I am able to use debugger statements in the browser with Chrome developer tools.

But I am not able to use debugger statements while running tests in the console with phantomJS and guard-teaspoon. Has anyone gotten this working? I use the rspec debugger a lot, and it would be great to have that same ability to debug with Teaspoon CLI.

jejacks0n commented 11 years ago

I haven't needed it -- like you say, I typically use chrome for debugging simply because it's easy.. however, there's a pretty interesting opportunity to figure this out. I did a quick google search and came up with this:

https://github.com/ariya/phantomjs/wiki/Troubleshooting#remote-debugging

I don't have the time currently to look into it more, but I'll be able to answer some questions if you have any.. I'd bet you can pass that flag to phantomjs (using the driver_cli_options configuration) and see how it turns out. Would appreciate you sharing your results. =)

andyl commented 11 years ago

@jejacks0n - yeah I had seen that remote-debugging config. It requires a browser, and there is configuration complexity. This seems like a more complicated version of the browser debugging that we already have.

I couldn't find any docco describing how to run the debugger in the CLI. I guess its not possible.

jejacks0n commented 10 years ago

you can edit the configuration to allow console.log through to std out. if that makes it easier.. also, since things run in the browser, you should be able to use the browser.

andyl commented 10 years ago

Yeah I was able to get console.log output on the CLI - super helpful.

Looked into the debug stuff some more & no luck. The browser-based 'remote-debugger' option that PhantomJS provides seems more complex than just running in the browser as we can do now.

PhantomJS has a nice command-line REPL. If there were a way to pop into the REPL in the context of a test, that would do the trick. But I couldn't figure out how. I studied Poltergiest to see if they had a debug/repl strategy, but no luck. Looking thru the PhantomJS issue tracker shows lots of discussion about the REPL, but couldn't find a way to enter the REPL during the execution of JS code.

andyl commented 10 years ago

One last comment - I asked about REPL/Debugger on the PhantomJS mailing list and didn't get any good answers, other than to use remote debugging. I found that Poltergiest supports remote debugging (https://github.com/teampoltergeist/poltergeist#remote-debugging-experimental), tried it and didn't find it to be better than running specs in the browser using Jasmine. So there still doesn't seem to be a good answer for using a PhantomJS debugger on the command line.