From 39270a1472e9b2a5c4d5be52bbc3ad608283dbaf Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 9 Apr 2016 18:01:08 +0200 Subject: [PATCH] test: fix issues for ESLint 2.7.0 PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White Reviewed-By: Jeremiah Senkpiel Reviewed-By: Rich Trott Reviewed-By: thefourtheye --- ...st-async-wrap-disabled-propagate-parent.js | 3 +- .../test-async-wrap-propagate-parent.js | 3 +- test/parallel/test-stream-writev.js | 37 +++++++++---------- test/parallel/test-timers-immediate.js | 3 +- test/parallel/test-timers-unref.js | 6 +-- 5 files changed, 24 insertions(+), 28 deletions(-) diff --git a/test/parallel/test-async-wrap-disabled-propagate-parent.js b/test/parallel/test-async-wrap-disabled-propagate-parent.js index 70d82befe72a63..55d2e59efb9ee7 100644 --- a/test/parallel/test-async-wrap-disabled-propagate-parent.js +++ b/test/parallel/test-async-wrap-disabled-propagate-parent.js @@ -7,7 +7,6 @@ const async_wrap = process.binding('async_wrap'); const providers = Object.keys(async_wrap.Providers); let cntr = 0; -let server; let client; function init(type, id, parent) { @@ -27,7 +26,7 @@ function noop() { } async_wrap.setupHooks(init, noop, noop); async_wrap.enable(); -server = net.createServer(function(c) { +const server = net.createServer(function(c) { client = c; // Allow init callback to run before closing. setImmediate(() => { diff --git a/test/parallel/test-async-wrap-propagate-parent.js b/test/parallel/test-async-wrap-propagate-parent.js index beeb27ba7866a9..6001539c624678 100644 --- a/test/parallel/test-async-wrap-propagate-parent.js +++ b/test/parallel/test-async-wrap-propagate-parent.js @@ -6,7 +6,6 @@ const net = require('net'); const async_wrap = process.binding('async_wrap'); let cntr = 0; -let server; let client; function init(type, id, parent) { @@ -25,7 +24,7 @@ function noop() { } async_wrap.setupHooks(init, noop, noop); async_wrap.enable(); -server = net.createServer(function(c) { +const server = net.createServer(function(c) { client = c; // Allow init callback to run before closing. setImmediate(() => { diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 2aa992b4a9a785..295bed2959398c 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -43,25 +43,24 @@ function test(decode, uncork, multi, next) { assert(false, 'Should not call _write'); }; - var expectChunks = decode ? - [ - { encoding: 'buffer', - chunk: [104, 101, 108, 108, 111, 44, 32] }, - { encoding: 'buffer', - chunk: [119, 111, 114, 108, 100] }, - { encoding: 'buffer', - chunk: [33] }, - { encoding: 'buffer', - chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, - { encoding: 'buffer', - chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]} - ] : [ - { encoding: 'ascii', chunk: 'hello, ' }, - { encoding: 'utf8', chunk: 'world' }, - { encoding: 'buffer', chunk: [33] }, - { encoding: 'binary', chunk: '\nand then...' }, - { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' } - ]; + var expectChunks = decode ? [ + { encoding: 'buffer', + chunk: [104, 101, 108, 108, 111, 44, 32] }, + { encoding: 'buffer', + chunk: [119, 111, 114, 108, 100] }, + { encoding: 'buffer', + chunk: [33] }, + { encoding: 'buffer', + chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, + { encoding: 'buffer', + chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]} + ] : [ + { encoding: 'ascii', chunk: 'hello, ' }, + { encoding: 'utf8', chunk: 'world' }, + { encoding: 'buffer', chunk: [33] }, + { encoding: 'binary', chunk: '\nand then...' }, + { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' } + ]; var actualChunks; w._writev = function(chunks, cb) { diff --git a/test/parallel/test-timers-immediate.js b/test/parallel/test-timers-immediate.js index 40e91a099815b6..4512ff47fb75a6 100644 --- a/test/parallel/test-timers-immediate.js +++ b/test/parallel/test-timers-immediate.js @@ -5,7 +5,6 @@ var assert = require('assert'); let immediateA = false; let immediateB = false; let immediateC = []; -let before; setImmediate(function() { try { @@ -16,7 +15,7 @@ setImmediate(function() { clearImmediate(immediateB); }); -before = process.hrtime(); +const before = process.hrtime(); immediateB = setImmediate(function() { immediateB = true; diff --git a/test/parallel/test-timers-unref.js b/test/parallel/test-timers-unref.js index 134b2ffe4c3967..570c51b9ac7a5f 100644 --- a/test/parallel/test-timers-unref.js +++ b/test/parallel/test-timers-unref.js @@ -7,7 +7,7 @@ let timeout_fired = false; let unref_interval = false; let unref_timer = false; let unref_callbacks = 0; -let interval, check_unref, checks = 0; +let checks = 0; var LONG_TIME = 10 * 1000; var SHORT_TIME = 100; @@ -28,7 +28,7 @@ setTimeout(function() { timeout_fired = true; }, LONG_TIME).unref(); -interval = setInterval(function() { +const interval = setInterval(function() { unref_interval = true; clearInterval(interval); }, SHORT_TIME); @@ -38,7 +38,7 @@ setTimeout(function() { unref_timer = true; }, SHORT_TIME).unref(); -check_unref = setInterval(function() { +const check_unref = setInterval(function() { if (checks > 5 || (unref_interval && unref_timer)) clearInterval(check_unref); checks += 1;