Search code examples
node.jsdebuggingkarma-runnerkarma-jasminenode-inspector

Debugging karma-jasmine tests with node-inspector


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


Solution

  • 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.