diff --git a/lib/cli/parse.js b/lib/cli/parse.js index 560cc715..419093d5 100644 --- a/lib/cli/parse.js +++ b/lib/cli/parse.js @@ -217,6 +217,10 @@ function parseDelay(value) { var millisPerSecond = 1000; var millis = 0; + if (typeof value !== 'string') { + return 0; + } + if (value.match(/^\d*ms$/)) { // Explicitly parse for milliseconds when using ms time specifier millis = parseInt(value, 10); diff --git a/test/cli/parse.test.js b/test/cli/parse.test.js index 2b79971f..4eadd04e 100644 --- a/test/cli/parse.test.js +++ b/test/cli/parse.test.js @@ -373,6 +373,11 @@ describe('nodemon with CoffeeScript', function () { }); describe('nodemon --delay argument', function () { + it('should support missing value gracefully', function () { + var settings = cli.parse('node nodemon --delay'); + assert(settings.delay === 0, 'delay 0 seconds'); + }); + it('should support an integer value', function () { var settings = cli.parse('node nodemon --delay 5'); assert(settings.delay === 5000, 'delay 5 seconds');