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
Debugging Hubot #648
Comments
I'm dealing with the same kind of thing. Right now it's kind of a shot in the dark. I don't really have an answer for you - I'm mainly just +1'ing this issue. |
The problem is that you are launching index.coffee which export the Robot class but does nothing else. hubot is started with the hubot script (https://github.com/github/hubot/blob/master/bin/hubot) which is a coffeescript file... without the .coffee extension. IntelliJ will not transpile it automatically. I haven't tried to rename/transpile it but I did copy part of that into a separate .coffee file that I use as a launcher for debugging purpose. See https://github.com/MacKeeper/jobot/blob/master/run_hubot.coffee and https://github.com/MacKeeper/jobot/blob/master/run_localhost.coffee. All of this is a little hackish but it works. Also, I had issues with libraries and IntelliJ transpiling so you might have to run "coffee -cmw ." in your projet or included node_modules. I would love to have better support for node/coffeescript debugging in IntelliJ (is it better in 13?). |
Hey Mac, Thanks for the advice. I went with Visual Studio in the end https://github.com/ppatarinski/Hubot_VisualStudio But the approach I took should also work with IntelliJ. The idea is you transpile the coffee script then you make the hubot.js file the start up file and debugging works :) Check out the repo above it should make more sense. Cheers |
Let's leave this open for a bit. Want to get something in the documentation. I also have had success using node-inspector for debugging. |
BTW, when debugging in intellij, everything has to be transpilled to .js. On Sun, Feb 16, 2014 at 10:11 PM, Josh Nichols notifications@github.comwrote:
|
Is there any way to debug using |
Check out https://github.com/node-inspector/node-inspector In your You'd need to have node-inspector in your package.json at some point. I'm not sure if you can set breakpoints in code (like ruby-debugger), but you can have it break at startup, and go in with chrome debugger to set some breakpoints before starting execution. |
@geoffreyanderson I know you have been doing some pretty heavy hubot script development in IntelliJ; could you throw something in docs/scripting.md with details? |
The book Automation and Monitoring with Hubot has a section on debugging. I've just tested that myself, and it seems to work well. Basically, the steps are:
Then, we can insert
Then, we visit I think we should get this into the Hubot documentation. Also, somebody more experienced might have something to add. |
I should also mention, I'm still not sure how to get access to things like |
Since yeoman is used to generate a hubot and more hubot scripts are being converted to individual npm packages, there's less need to open the generated hubot repo in IntelliJ. What we've done is setup basic testing for new scripts in a separate repo and run most of that via the CLI since there seems to be a transpiling dependency for IntellIiJ to follow along. I'll dig a little more and see if I can figure out a basic enough testing pattern with IntelliJ that plays nicely with this stuff. I think setting up the transpiler to throw the maps and JS files into a different directory (as per https://www.jetbrains.com/idea/help/transpiling-coffeescript-to-javascript.html#d305745e612) might help get around some issues with scripts getting double-loaded too. |
When you get IntelliJ cleanly setup with a hubot checkout #845 makes any run/debug configurations simply fail. If you use #877 it appears to fix the problem with starting a runner from IntelliJ. As for debugging from IntelliJ...it seems like the various permutations of a nodejs runner either can't be used in a debug mode or can only load a javascript console such that you can't access STDIN to invoke specific script commands (boo :( ) If folks still want to setup a new intellij project, the high-level set of steps are:
|
Does anyone know of a solid pattern for testing/debugging individual scripts (e.g. |
For inspect based debugging in development, I usually include a line like: console.log require('util').inspect thingToDebug When using the shell adapter in development, that should be logged to the console. If you are debugging something in production, you'll want to log with |
Hi Paul, try this out : a doc about setting up coffee in Intellij https://www.jetbrains.com/help/idea/2017.1/debugging-coffeescript.html. I remember the debug point can be set in coffee file directly. |
x-post from Slack discussion on same topic... I've had some success using atom and xatom-debug with unit tests, by running mocha with the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Pinging this thread to keep stale bot's hands off it. I wouldn't consider it closed until there's a standard recommended and documented approach to running hubot with node debug enabled. Which I can hopefully provide myself, just haven't got to it yet. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi everyone,
I am new to node.js and coffee script. I have hubot running on my windows machine, but what I am trying to accomplish is debug hubot and any of the hubot scripts. How can I got about achieving that? So far I have gotten IntelliJ running and transpiling the coffee script to js. And my breakpoints hit in the index.js (or index.coffee), however stepping over the return new Robot line (line 25 in index.coffee) closes down the application.
Thank you
Paul
The text was updated successfully, but these errors were encountered: