Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/cli/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions test/cli/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down