diff options
Diffstat (limited to 'deps/npm/node_modules/lockfile/test/retry-time.js')
-rw-r--r-- | deps/npm/node_modules/lockfile/test/retry-time.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/deps/npm/node_modules/lockfile/test/retry-time.js b/deps/npm/node_modules/lockfile/test/retry-time.js index 160bc1376d..7d5eaa8499 100644 --- a/deps/npm/node_modules/lockfile/test/retry-time.js +++ b/deps/npm/node_modules/lockfile/test/retry-time.js @@ -17,7 +17,7 @@ var RETRYWAIT = 100 var WAIT = 100 var RETRIES = 2 var EXPECTTIME = (RETRYWAIT * RETRIES) + (WAIT * (RETRIES + 1)) -var TOOLONG = EXPECTTIME * 1.1 +var TOOLONG = EXPECTTIME * 1.5 test('setup', function (t) { touch.sync('file.lock') @@ -33,7 +33,9 @@ pollPeriods.forEach(function (pp) { ended = true t.end() }, 2000) - timer.unref() + + if (timer.unref) + timer.unref() var start = Date.now() lockFile.lock('file.lock', { @@ -56,7 +58,11 @@ pollPeriods.forEach(function (pp) { test('cleanup', function (t) { fs.unlinkSync('file.lock') t.end() - setTimeout(function() { + var timer = setTimeout(function() { process.exit(1) - }, 500).unref() + }, 500) + if (timer.unref) + timer.unref() + else + clearTimeout(timer) }) |