5

Almost the same question as Debugging jasmine-node tests with node-inspector BUT does anyone know how to use node-inspector with karma?

Community
  • 1
  • 1
Andy
  • 7,885
  • 5
  • 55
  • 61

1 Answers1

8

Install the node-inspector globally from NPM:

npm install -g node-inspector

Then start the node-inspector and background the process (use fg to bring it back to the foreground and kill %1 to stop it):

node-inspector &

And then start your test runner like in debug mode this

node --inspect ./node_modules/karma/bin/karma start

Then connect to the inspector from your local loopback. To start debugging, open the following URL in Chrome: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/e771f282-5e94-4247-ac1c-89d7dc035129

If all goes well, you’ll see some developer tools from which to begin debugging.

tuvokki
  • 720
  • 1
  • 10
  • 18
  • Cool, I've been working on another project for the last few weeks so it may take me a little while to try this out, but this sounds right. Thanks! – Andy May 01 '15 at 15:54
  • No rush ;) If it works let me know (and accept the answer) else I'd be glad to help. – tuvokki May 02 '15 at 19:41
  • 1
    @chadoh Yes, although I can't remember for the life of me why I asked this question -- it doesn't make sense because you can't debug any of the code running in the browser via node-inspector. – Andy Dec 10 '15 at 19:25
  • 1
    How are you debugging the code? The files aren't appearing in my node inspector, and placing `debugger` statements in my code doesn't seem to do anything, the tests just run. – A. Duff Jun 16 '17 at 15:03