• Stars
    star
    428
  • Rank 101,481 (Top 2 %)
  • Language
    JavaScript
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔍 Dead simple debugging for node.js using chrome-devtools.

inspect-process

Dead simple debugging for node.js using chrome-devtools.

Build Status Coverage Status Standard - JavaScript Style Guide
NPM inspect-process package Dependency Status devDependency Status


Why?

Node added support for v8-inspector in v6.3.0 but launching the debugger for a given process is still a little clumsy. inspect-process solves the following problems:

  • Opening and refreshing devtools - A new instance is launched each time a process is launched.
  • Unable to debug executables - Looks up path to executables such as mocha, grunt, by looking in PATH prior to resolving as a file.
  • 'Unable to open devtools socket: address already in use' - Finds an open port prior to starting the inspector. Begins searching for available ports starting at the node default inspector port, 9229.
  • Requiring debug-brk - Bypasses the user requirement of setting this flag by ensuring devtools is connected prior to advancing. Just set your debug break points, and inspect-process will be able to pick it up.

Behind the scenes inspect-process attempts to normalize your experience by:

  • Hiding the noisy output broadcast by the default --inspect flag. You don't need to worry about attaching,detaching, and cleaning up. Just inspect.
  • Automatically forcing color output; plays nicely with any module utilzing supports-color.

How is this different from node-inspector?

inspect-process is only a small wrapper around the native --inspect functionaltiy provided by node. The key differences between utilizing --inspect and node-inspector can be found in this comment by pavelfeldman

Usage

Install this globally and you'll have access to the inspect command anywhere on your system.

npm install -g inspect-process

Inspecting a file

$ inspect index.js

Inspecting an executable

$ inspect grunt

Passing arguments to process

Just pass your arguments after the process.

inspect index.js --argument=val

Passing arguments to node

Arguments are passed to the process just as if you were utilizing the node CLI.

inspect --harmony index.js

Options

--debug-exception Pause debugger on exceptions. [boolean]

--log-level: The level to display logs at. [string] (choices: "silly", "verbose", "info")

Tests

Install Dependencies

npm install

Run

npm test

Known Issues

Child Processes

Inspecting a child process is not currently possible (and most likely never will be). Unfortunately inspect-process can not force child processes to spawn with the necessary --inspect flag.

This is clear when looking at all of the provided mocha examples. The actual mocha executable is a wrapper that spawns _mocha (done in order to allow passing flags to the node process). In order to use mocha with inspect-process, we have to bypass that first indirection and use the _mocha exectuable directly: inspect _mocha.

If you have control of the source code responsible for spawning the child process, it is technically possible to still utilize inspect-process by working with programatic api, however this is not recommended for most use cases.

Internet Connectivity (> Node 7.1.0)

Versions of Node prior to 7.1.0 require a specific devtools version which is downloaded from the cloud (hence "remote" in the URL string). Node 7.1.0 and on will be exposing a stable protocol which will work with the devtools version bundled with the Chrome (source).

License

The MIT License (MIT) Copyright (c) 2016 Jarid Margolin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

formatter.js

Format html inputs to match a specified pattern
JavaScript
2,491
star
2

bouncefix.js

🚫 Stop full body elastic scroll bounce when scrolling inside nested containers (IOS)
JavaScript
84
star
3

marionette.components

🎛 A collection of Classes to interact with with Marionette.Views.
JavaScript
11
star
4

properly-styled

🎨 Prop based component styling
TypeScript
9
star
5

portfinder-sync

Find an open port synchronously.
JavaScript
8
star
6

s3-site

Create, manipulate, and deploy static websites to Amazon S3
JavaScript
7
star
7

marionette.dynamiclayout

Mange layouts and views via controllers.
JavaScript
5
star
8

neutrino-contrib

A collection of neutrino plugins and presets (NOT OFFICIALLY SUPPORTED BY NEUTRINO)
JavaScript
5
star
9

endpoints.js

Module for creating browser based api clients.
JavaScript
4
star
10

react-static-plugin-svg

A React-Static plugin that adds loader support for svg
JavaScript
4
star
11

rc-socket

A more robust WebSocket interface.
TypeScript
4
star
12

flvr

🌶 Add some flavor to how your errors display.
JavaScript
4
star
13

assist.js

Modular utility mixins.
JavaScript
3
star
14

jquery.tap

A jQuery plugin that creates a click alternative for touch enabled browsers.
JavaScript
3
star
15

child.js

🐣 Inheritance for javascript.
JavaScript
2
star
16

pre-flight.js

Tiny method to alter $.ajax to send JSON.stringified body for POST and PUT requests.
JavaScript
2
star
17

fakey.js

Synthesize user keystrokes on input elements.
JavaScript
2
star
18

mini-store.js

Lightweight class to store and manage data.
JavaScript
2
star
19

stringspace.js

Utility for using namespaced strings to get and set object properties.
JavaScript
1
star
20

env.js

Toggle environment configuration based on url hostname patterns.
JavaScript
1
star
21

aflow.js

Collection of async flow control methods.
JavaScript
1
star
22

dom-event.js

A more convenient DOM EventListener.
JavaScript
1
star
23

codeframe

🖼 Terminal code previews
JavaScript
1
star
24

jest-dedupe-resolver

Custom Jest resolver to remove duplicate dependencies caused by `npm link`
JavaScript
1
star
25

event-emitter.js

Lightweight EventEmitter Class
JavaScript
1
star
26

wd-elements

🎛 Better elements for selenium-webdriver
JavaScript
1
star
27

vagrant-press

Wordpress development - Vagrant, chef, berkshelf, roots.
Ruby
1
star
28

semver.js

Lightweight module to compare semver versions.
JavaScript
1
star