Skip to content

Instantly share code, notes, and snippets.

@tripu

tripu/nodejs-commands.md

Last active May 29, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.