From 9d99c24d502a072a8e59dc5c170d06b98dfb3cd1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jan 2022 06:47:03 -0800 Subject: [PATCH] test: prepare tests for no-cond-assign ESLint rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41614 Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen --- test/parallel/test-child-process-flush-stdio.js | 2 +- test/parallel/test-net-server-max-connections.js | 2 +- test/parallel/test-stream-readable-object-multi-push-async.js | 2 +- test/parallel/test-stream-unshift-empty-chunk.js | 2 +- test/parallel/test-zlib-brotli-flush.js | 2 +- test/parallel/test-zlib-flush.js | 2 +- test/parallel/test-zlib-params.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-child-process-flush-stdio.js b/test/parallel/test-child-process-flush-stdio.js index a7c1ea21be22a4..7b9a2a049cb20b 100644 --- a/test/parallel/test-child-process-flush-stdio.js +++ b/test/parallel/test-child-process-flush-stdio.js @@ -27,7 +27,7 @@ const spawnWithReadable = () => { })); p.stdout.on('readable', () => { let buf; - while (buf = p.stdout.read()) + while ((buf = p.stdout.read()) !== null) buffer.push(buf); }); }; diff --git a/test/parallel/test-net-server-max-connections.js b/test/parallel/test-net-server-max-connections.js index 705c99b7b9737a..ea9a8d29e9f1ed 100644 --- a/test/parallel/test-net-server-max-connections.js +++ b/test/parallel/test-net-server-max-connections.js @@ -68,7 +68,7 @@ function makeConnection(index) { if (closes === N / 2) { let cb; console.error('calling wait callback.'); - while (cb = waits.shift()) { + while ((cb = waits.shift()) !== undefined) { cb(); } server.close(); diff --git a/test/parallel/test-stream-readable-object-multi-push-async.js b/test/parallel/test-stream-readable-object-multi-push-async.js index 17c84c7310e053..3bdbe4d3517c48 100644 --- a/test/parallel/test-stream-readable-object-multi-push-async.js +++ b/test/parallel/test-stream-readable-object-multi-push-async.js @@ -47,7 +47,7 @@ const BATCH = 10; readable.on('readable', () => { let data; console.log('readable emitted'); - while (data = readable.read()) { + while ((data = readable.read()) !== null) { console.log(data); } }); diff --git a/test/parallel/test-stream-unshift-empty-chunk.js b/test/parallel/test-stream-unshift-empty-chunk.js index dbcafbfdcb7ad2..e8136a68e9e6aa 100644 --- a/test/parallel/test-stream-unshift-empty-chunk.js +++ b/test/parallel/test-stream-unshift-empty-chunk.js @@ -41,7 +41,7 @@ let readAll = false; const seen = []; r.on('readable', () => { let chunk; - while (chunk = r.read()) { + while ((chunk = r.read()) !== null) { seen.push(chunk.toString()); // Simulate only reading a certain amount of the data, // and then putting the rest of the chunk back into the diff --git a/test/parallel/test-zlib-brotli-flush.js b/test/parallel/test-zlib-brotli-flush.js index 6883fb903a6478..fd730bfacd3189 100644 --- a/test/parallel/test-zlib-brotli-flush.js +++ b/test/parallel/test-zlib-brotli-flush.js @@ -16,7 +16,7 @@ deflater.write(chunk, function() { deflater.flush(function() { const bufs = []; let buf; - while (buf = deflater.read()) + while ((buf = deflater.read()) !== null) bufs.push(buf); actualFull = Buffer.concat(bufs); }); diff --git a/test/parallel/test-zlib-flush.js b/test/parallel/test-zlib-flush.js index 965cb5c45b13ea..557775d5091a46 100644 --- a/test/parallel/test-zlib-flush.js +++ b/test/parallel/test-zlib-flush.js @@ -23,7 +23,7 @@ deflater.write(chunk, function() { deflater.flush(function() { const bufs = []; let buf; - while (buf = deflater.read()) + while ((buf = deflater.read()) !== null) bufs.push(buf); actualFull = Buffer.concat(bufs); }); diff --git a/test/parallel/test-zlib-params.js b/test/parallel/test-zlib-params.js index 293ceecf8fa02a..30d4f133ad43bd 100644 --- a/test/parallel/test-zlib-params.js +++ b/test/parallel/test-zlib-params.js @@ -21,7 +21,7 @@ deflater.write(chunk1, function() { deflater.end(chunk2, function() { const bufs = []; let buf; - while (buf = deflater.read()) + while ((buf = deflater.read()) !== null) bufs.push(buf); actual = Buffer.concat(bufs); });