This package has been deprecated

Author message:

This

gulp-node-debug

0.0.4 • Public • Published

This project is not maintained anymore. The code does not run on node 4+ and I don't have time and moot to fix that.

I reommend the debugger from Visual Studio Code as a great replacement: Screenshot


gulp-node-debug

NPM version Dependency Status

A wrapper around node-inspector for gulp, has the same functionality as the node-debug command.

Perfect for development. Easy to use.

  1. Runs node-inspector.
  2. Runs the supplied script in debug mode
  3. Opens the user's browser, pointing it at the inspector.

Installation

npm install gulp-node-debug --save-dev

Usage

This is the minimal setup. The file app.js will be debugged with default values.

// gulpfile.js
var gulp = require('gulp');
var nodeDebug = require('gulp-node-debug');
gulp.task('debug', function() {
 
    gulp.src(['app.js'])
        .pipe(nodeDebug());
});

Add debugBrk: true if your script finishes immediately:

// gulpfile.js
var gulp = require('gulp');
var nodeDebug = require('gulp-node-debug');
gulp.task('debug', function() {
 
    gulp.src(['app.js'])
        .pipe(nodeDebug({
            debugBrk: true
        }));
});

This example shows all available options (default values):

// gulpfile.js
var gulp = require('gulp');
var nodeDebug = require('gulp-node-debug');
gulp.task('debug', function() {
 
    gulp.src(['app.js'])
        .pipe(nodeDebug({
            debugPort: 5858,
            webHost: '0.0.0.0',
            webPort: 8080,
            debugBrk: false,
            nodejs: [],
            script: [],
            saveLiveEdit: false,
            preload: true,
            inject: true,
            hidden: [],
            stackTraceLimit: 50,
            sslKey: '',
            sslCert: ''
        }));
});

Enter gulp debug in your shell to start the node-inspector, run the supplied script and to open the debug URL in Chrome, Chromium or Opera.

How to debug Mocha unit-tests?

You have to start _mocha as the debugged process. Try out the watch option, which makes sure that the debugged process does not end after execution of all tests.

// gulpfile.js
var gulp = require('gulp');
var nodeDebug = require('gulp-node-debug');
gulp.task('debugTest', function() {
 
    var mochaScript = path.join(__dirname, 'node_modules/mocha/bin/_mocha');
 
    gulp.src([mochaScript])
        .pipe(nodeDebug({
            debugBrk: true,
            script: ['--watch'],
        }));
});
   

Options

All options are written in camelCase style:

Option Default Description
debugPort 5858 Node/V8 debugger port.
webHost '0.0.0.0' Host to listen on for Node Inspector's web interface. node-debug listens on 127.0.0.1 by default.
webPort 8080 Port to listen on for Node Inspector's web interface.
node-debug
debugBrk true Break on the first line.
nodejs [] List of string to pass NodeJS options to debugged process.
script [] List of string to pass options to debugged process.
node-inspector
saveLiveEdit false Save live edit changes to disk (update the edited files).
preload true Preload *.js files. You can disable this option
to speed up the startup.
inject true Enable injection of debugger extensions into the debugged process.
hidden [] Array of files to hide from the UI, breakpoints in these files will be ignored. All paths are interpreted as regular expressions.
stackTraceLimit 50 Number of stack frames to show on a breakpoint.
sslKey '' Path to file containing a valid SSL key.
sslCert '' Path to file containing a valid SSL certificate.

Credits

This project was forked from gulp-node-inspector which wraps node-inspector (but does not start a debugged process). All real work was done by node-inspector.

License

The MIT License (MIT)

Copyright (c) 2015 Johannes Hoppe (http://haushoppe-its.de)

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.

Dependencies (7)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i gulp-node-debug

    Weekly Downloads

    6

    Version

    0.0.4

    License

    MIT

    Last publish

    Collaborators

    • johanneshoppe