NOTE
StrongLoop Arc and slc are no longer under active development, and will soon be deprecated. Arc's features are being included in the IBM API Connect Developer Toolkit: Please use it instead.
Skip to end of metadata
Go to start of metadata

Overview

Node Inspector is based on Chrome Developer Tools and thus debugging a Node application with it is similar to debugging client JavaScript in Chrome.  See the Chrome Developer Tools Guide for a walkthrough of other debugger features.  

Node Inspector loads and parses files during a debug session and automatically adds them to the GUI. This is useful for –debug-brk and stepping through require() calls. 

Setting a breakpoint

To set a breakpoint in application code:

  1. Click on the "Show navigator" icon in the upper-left corner of the Node Inspector window to see a tree-list of all source files:
     
  2. Find the desired JavaScript file and double-click to open it.
  3. Click on the desired line number to set a breakpoint there. 
    Node Inspector highlights the line number in blue. 
     

Press F10 to step through Javascript statements.  Press F8 to resume script execution.

Breakpoints and uncaught exceptions

Node Inspector restores breakpoints after you restart an application and remembers your breakpoints in the browser's local storage (HTML5). When you restart the debugger process, or start debugging the same application after several days, Node Inspector restores the breakpoints.

You can also break on uncaught exceptions.  Node Inspector also provides integration with domains: exceptions handled by domain’s error handler are still considered uncaught. This feature requires Node.js v0.11.3 or greater.

Setting breakpoints in files not yet loaded

REVIEW COMMENT from Rand
Ask Miroslav to clarify. Feature isn't specific to mocha: it can happen with other test frameworks, or even just general code.  Separate the part that involves mocha as an example, and the general stuff,

Node Inspector enables you to set breakpoints in files that are not yet loaded into the V8 runtime.  

To do this, for example for Mocha unit tests:

  • Run mocha unit-test in any project with the –debug-brk option.
  • Launch Node Inspector.
  • Look at source files of your unit tests and set breakpoints inside them.
  • Resume execution when you have all breakpoints set up
  • Wait for debugger to hit your first breakpoint.

Display and edit variables

Hover a variable to display and edit its value, as illustrated below:

Support for source maps

REVIEW COMMENT from Rand
Is this relevant here? Does NI still support source maps?–no mention in README or wiki..

Node Inspector supports source maps, enabling you to keep client-side code readable and debuggable even when combined and minified, without impacting performance. For example, you can compile CoffeeScript, LiveScript or TypeScript files with source-map option turned on. Node Inspector will show you the CoffeScript, LiveScript or TypeScript source instead of trans-piled JavaScript. Also, you can set breakpoints in these files.

Re-execute functions with "Restart Frame"

REVIEW COMMENT from Rand
Does this still work? Not in README or wiki.

Right-click on a call frame (stack frame) in the right sidebar and select the ”Restart frame” command to re-execute the current function from the beginning.

  • No labels