Skip to content

Instantly share code, notes, and snippets.

@tripu
Last active May 29, 2020 10:14
Show Gist options
  • Save tripu/69e5506ab6bbe06d0921 to your computer and use it in GitHub Desktop.
Save tripu/69e5506ab6bbe06d0921 to your computer and use it in GitHub Desktop.
Commands for Node.js development and debugging

(See also my npm setup, and useful global packages)

Commands for Node.js development and debugging

Run

App

$ node <APP>

Tests

$ mocha

Run in strict mode

App

$ node --use_strict <APP>

Tests

Not possible with mocha, AFAIK.

Debug

App

  • $ node --inspect[=<PORT>] <APP>
  • Open about:inspect in Chrom* (you'll be redirected to chrome://inspect)
  • Click “Open dedicated DevTools for Node”

Tests

  • Preferred:
    $ node --inspect ./node_modules/mocha/bin/mocha <APP>
  • Old:
    $ mocha --debug-brk & node-inspector [-p <PORT>]
    Then visit http://localhost:PORT on Chrom*.
  • Also:
    $ node-debug [-p <PORT>] _mocha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment