Pregunta

I've setup a Eclipse kepler (v4.3.2) with Chromium JavaScript Remote Debugger to be able to remote debug a node.js process (Connect to V8Debugger). Then I have started protractor with

node --debug-brk protractor.js conf.js

Where protractor.js is the shellscript file inside the bin folder of the node_module protractor directory missing the first line which starts node. So node is then startet in debug mode listening on port 5858 for debugger connection. Inside eclipse I have configured a Standalone V8 VM Debugger Configuration for connecting on local port 5858. After connecting to the node.js server it hits the first breakpoint inside the protractor.js file. But when resuming/continue execution it repeats "debugger listening on port 5858" inside the console and do not continue with testing.

Can someone tell me what's the problem with this?

Regards, Sebastian

¿Fue útil?

Solución

Ok here is the answer: How to debug Node.JS child forked process?

In Short: It is a bug in node.js v0.10 where it is impossible to debug child processes.

But it is still possible to debug the childprocess also:

And as a amendment here is my solution: Change the code inside launcher.js to fork the childprocess with --debug-brk also! And give it a unique port as explained in the posted link above. Then you need to set a breakpoint (or put debugger; inside the code) before the childFork.process.send('run',...) function to stop the code from sending the message to the forked process. This is needed because you have stopped the childprocess from running by setting --debug-brk. So connect to the second process and hit continue. You will see that the childprocess (runFromLauncher) will wait until message 'run' is received. and so switch back to the first debugger, hit run and let it send the message to the childprocess. You will see, if you set a breakpoint inside the process.on.message(...) function in runFromLauncher.js, you can step through the code again.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top