diff --git a/lib/timers.js b/lib/timers.js index 0dc9ed80b7e577..50ae477d59d30f 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -30,7 +30,7 @@ var lists = {}; // with them. exports.active = function(item) { const msecs = item._idleTimeout; - if (msecs < 0) return; + if (msecs < 0 || msecs === undefined) return; item._idleStart = Timer.now(); diff --git a/test/parallel/test-timers-active.js b/test/parallel/test-timers-active.js index 9162406848d195..acddc2f41a45e8 100644 --- a/test/parallel/test-timers-active.js +++ b/test/parallel/test-timers-active.js @@ -22,7 +22,8 @@ legitTimers.forEach(function(legit) { // active() should not create a timer for these var bogusTimers = [ - { _idleTimeout: -1 } + { _idleTimeout: -1 }, + { _idleTimeout: undefined }, ]; bogusTimers.forEach(function(bogus) {