diff --git a/test/addons/uv-handle-leak/test.js b/test/addons/uv-handle-leak/test.js index 73d40ca7996274..9c2272fce2e2a9 100644 --- a/test/addons/uv-handle-leak/test.js +++ b/test/addons/uv-handle-leak/test.js @@ -16,7 +16,9 @@ try { const { isMainThread } = require('worker_threads'); if (!isMainThread) common.skip('Cannot run test in environment with clean-exit policy'); -} catch {} +} catch { + // Continue regardless of error +} binding.leakHandle(); binding.leakHandle(0); diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index fec48ddcba7b9c..4692121b0cdbff 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -365,8 +365,9 @@ class NodeInstance extends EventEmitter { ['--expose-internals'], `${scriptContents}\nprocess._rawDebug('started');`, undefined); const msg = 'Timed out waiting for process to start'; - while (await fires(instance.nextStderrString(), msg, TIMEOUT) !== - 'started') {} + while (await fires(instance.nextStderrString(), msg, TIMEOUT) !== 'started') { + // empty + } process._debugProcess(instance._process.pid); return instance; } diff --git a/test/common/report.js b/test/common/report.js index 98e230e769fca9..52a7bc906f9000 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -46,7 +46,9 @@ function validateContent(report, fields = []) { } catch (err) { try { err.stack += util.format('\n------\nFailing Report:\n%O', report); - } catch {} + } catch { + // Continue regardless of error + } throw err; } } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 717b4dc01ea027..b591c23196f4ad 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -184,7 +184,9 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch {} + try { sendSocket.close(); } catch { + // Continue regardless of error + } return; } diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js index e19f8dc05b747a..e8a9f6cc9543fe 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -170,7 +170,9 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch {} + try { sendSocket.close(); } catch { + // Continue regardless of error + } return; } diff --git a/test/internet/test-dgram-multicast-ssm-multi-process.js b/test/internet/test-dgram-multicast-ssm-multi-process.js index 5653559e243c7a..b773cf9f09d5b2 100644 --- a/test/internet/test-dgram-multicast-ssm-multi-process.js +++ b/test/internet/test-dgram-multicast-ssm-multi-process.js @@ -164,7 +164,9 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch {} + try { sendSocket.close(); } catch { + // Continue regardless of error + } return; } diff --git a/test/internet/test-dgram-multicast-ssmv6-multi-process.js b/test/internet/test-dgram-multicast-ssmv6-multi-process.js index e139d93a971a28..69cf0276a1aa76 100644 --- a/test/internet/test-dgram-multicast-ssmv6-multi-process.js +++ b/test/internet/test-dgram-multicast-ssmv6-multi-process.js @@ -164,7 +164,9 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch {} + try { sendSocket.close(); } catch { + // Continue regardless of error + } return; } diff --git a/test/message/vm_dont_display_runtime_error.js b/test/message/vm_dont_display_runtime_error.js index 72568a21c7c339..f74bd6c6cbcef1 100644 --- a/test/message/vm_dont_display_runtime_error.js +++ b/test/message/vm_dont_display_runtime_error.js @@ -30,7 +30,9 @@ try { filename: 'test.vm', displayErrors: false }); -} catch {} +} catch { + // Continue regardless of error +} console.error('middle'); diff --git a/test/message/vm_dont_display_syntax_error.js b/test/message/vm_dont_display_syntax_error.js index 7e588c5095741a..dd60d04723b502 100644 --- a/test/message/vm_dont_display_syntax_error.js +++ b/test/message/vm_dont_display_syntax_error.js @@ -30,7 +30,9 @@ try { filename: 'test.vm', displayErrors: false }); -} catch {} +} catch { + // Continue regardless of error +} console.error('middle'); diff --git a/test/node-api/test_fatal/test_threads.js b/test/node-api/test_fatal/test_threads.js index fd56f60cbe832f..20ff77791152e3 100644 --- a/test/node-api/test_fatal/test_threads.js +++ b/test/node-api/test_fatal/test_threads.js @@ -9,7 +9,9 @@ const test_fatal = require(`./build/${common.buildType}/test_fatal`); if (process.argv[2] === 'child') { test_fatal.TestThread(); // Busy loop to allow the work thread to abort. - while (true) {} + while (true) { + // empty + } } const p = child_process.spawnSync( diff --git a/test/node-api/test_fatal/test_threads_report.js b/test/node-api/test_fatal/test_threads_report.js index 83c6642bdc41eb..bad04f676c6524 100644 --- a/test/node-api/test_fatal/test_threads_report.js +++ b/test/node-api/test_fatal/test_threads_report.js @@ -16,7 +16,9 @@ if (common.buildType === 'Debug') if (process.argv[2] === 'child') { test_fatal.TestThread(); // Busy loop to allow the work thread to abort. - while (true) {} + while (true) { + // empty + } } tmpdir.refresh(); diff --git a/test/parallel/test-async-hooks-run-in-async-scope-caught-exception.js b/test/parallel/test-async-hooks-run-in-async-scope-caught-exception.js index 78e38c1e9312d7..66155b527e7d21 100644 --- a/test/parallel/test-async-hooks-run-in-async-scope-caught-exception.js +++ b/test/parallel/test-async-hooks-run-in-async-scope-caught-exception.js @@ -5,5 +5,7 @@ const { AsyncResource } = require('async_hooks'); try { new AsyncResource('foo').runInAsyncScope(() => { throw new Error('bar'); }); -} catch {} +} catch { + // Continue regardless of error +} // Should abort (fail the case) if async id is not matching. diff --git a/test/parallel/test-cluster-kill-infinite-loop.js b/test/parallel/test-cluster-kill-infinite-loop.js index bd2384941b2122..92e5e7edb31628 100644 --- a/test/parallel/test-cluster-kill-infinite-loop.js +++ b/test/parallel/test-cluster-kill-infinite-loop.js @@ -17,5 +17,7 @@ if (cluster.isPrimary) { assert.strictEqual(signal, 'SIGTERM'); })); } else { - while (true) {} + while (true) { + // empty + } } diff --git a/test/parallel/test-domain-with-abort-on-uncaught-exception.js b/test/parallel/test-domain-with-abort-on-uncaught-exception.js index 5eed67d28ffa58..55c2c2a1b422cc 100644 --- a/test/parallel/test-domain-with-abort-on-uncaught-exception.js +++ b/test/parallel/test-domain-with-abort-on-uncaught-exception.js @@ -49,6 +49,7 @@ if (process.argv[2] === 'child') { try { throw new Error(domainErrHandlerExMessage); } catch { + // Continue regardless of error } } else { throw new Error(domainErrHandlerExMessage); diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index 487b5d44054373..bd3168201e2f1d 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -56,7 +56,9 @@ process.on('exit', function() { function removeTestFile() { try { fs.unlinkSync(filepath); - } catch {} + } catch { + // Continue regardless of error + } } diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js index d8e1c94300d2ed..e6f547d3e92ce7 100644 --- a/test/parallel/test-fs-access.js +++ b/test/parallel/test-fs-access.js @@ -60,6 +60,7 @@ if (!common.isWindows && process.getuid() === 0) { process.setuid('nobody'); hasWriteAccessForReadonlyFile = false; } catch { + // Continue regardless of error } } diff --git a/test/parallel/test-fs-promises-watch.js b/test/parallel/test-fs-promises-watch.js index 31ab1aafd43e63..ee30b062a07d93 100644 --- a/test/parallel/test-fs-promises-watch.js +++ b/test/parallel/test-fs-promises-watch.js @@ -75,33 +75,57 @@ for (const testCase of kCases) { } assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch(1)) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch(1)) { + // empty + } + }, { code: 'ERR_INVALID_ARG_TYPE' }); assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch(__filename, 1)) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch(__filename, 1)) { + // empty + } + }, { code: 'ERR_INVALID_ARG_TYPE' }); assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch('', { persistent: 1 })) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch('', { persistent: 1 })) { + // empty + } + }, { code: 'ERR_INVALID_ARG_TYPE' }); assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch('', { recursive: 1 })) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch('', { recursive: 1 })) { + // empty + } + }, { code: 'ERR_INVALID_ARG_TYPE' }); assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch('', { encoding: 1 })) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch('', { encoding: 1 })) { + // empty + } + }, { code: 'ERR_INVALID_ARG_VALUE' }); assert.rejects( - // eslint-disable-next-line no-unused-vars - async () => { for await (const _ of watch('', { signal: 1 })) {} }, + async () => { + // eslint-disable-next-line no-unused-vars + for await (const _ of watch('', { signal: 1 })) { + // empty + } + }, { code: 'ERR_INVALID_ARG_TYPE' }); (async () => { @@ -110,7 +134,9 @@ assert.rejects( setImmediate(() => ac.abort()); try { // eslint-disable-next-line no-unused-vars - for await (const _ of watch(__filename, { signal })) {} + for await (const _ of watch(__filename, { signal })) { + // empty + } } catch (err) { assert.strictEqual(err.name, 'AbortError'); } diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 488e4b4ceaada3..1e8cdb45f06171 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -108,7 +108,9 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) { [ [entry, `../${path.basename(tmpDir)}/cycles/root.js`], ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch {} + try { fs.unlinkSync(t[0]); } catch { + // Continue regardless of error + } console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file'); fs.symlinkSync(t[1], t[0], 'file'); unlink.push(t[0]); @@ -134,7 +136,9 @@ function test_simple_absolute_symlink(realpath, realpathSync, callback) { [ [entry, expected], ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch {} + try { fs.unlinkSync(t[0]); } catch { + // Continue regardless of error + } console.error('fs.symlinkSync(%j, %j, %j)', t[1], t[0], type); fs.symlinkSync(t[1], t[0], type); unlink.push(t[0]); @@ -159,13 +163,17 @@ function test_deep_relative_file_symlink(realpath, realpathSync, callback) { expected); const linkPath1 = path.join(targetsAbsDir, 'nested-index', 'one', 'symlink1.js'); - try { fs.unlinkSync(linkPath1); } catch {} + try { fs.unlinkSync(linkPath1); } catch { + // Continue regardless of error + } fs.symlinkSync(linkData1, linkPath1, 'file'); const linkData2 = '../one/symlink1.js'; const entry = path.join(targetsAbsDir, 'nested-index', 'two', 'symlink1-b.js'); - try { fs.unlinkSync(entry); } catch {} + try { fs.unlinkSync(entry); } catch { + // Continue regardless of error + } fs.symlinkSync(linkData2, entry, 'file'); unlink.push(linkPath1); unlink.push(entry); @@ -186,13 +194,17 @@ function test_deep_relative_dir_symlink(realpath, realpathSync, callback) { const path1b = path.join(targetsAbsDir, 'nested-index', 'one'); const linkPath1b = path.join(path1b, 'symlink1-dir'); const linkData1b = path.relative(path1b, expected); - try { fs.unlinkSync(linkPath1b); } catch {} + try { fs.unlinkSync(linkPath1b); } catch { + // Continue regardless of error + } fs.symlinkSync(linkData1b, linkPath1b, 'dir'); const linkData2b = '../one/symlink1-dir'; const entry = path.join(targetsAbsDir, 'nested-index', 'two', 'symlink12-dir'); - try { fs.unlinkSync(entry); } catch {} + try { fs.unlinkSync(entry); } catch { + // Continue regardless of error + } fs.symlinkSync(linkData2b, entry, 'dir'); unlink.push(linkPath1b); unlink.push(entry); @@ -216,7 +228,9 @@ function test_cyclic_link_protection(realpath, realpathSync, callback) { [path.join(tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'], [path.join(tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a'], ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch {} + try { fs.unlinkSync(t[0]); } catch { + // Continue regardless of error + } fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); @@ -243,7 +257,9 @@ function test_cyclic_link_overprotection(realpath, realpathSync, callback) { const link = `${folder}/cycles`; let testPath = cycles; testPath += '/folder/cycles'.repeat(10); - try { fs.unlinkSync(link); } catch {} + try { fs.unlinkSync(link); } catch { + // Continue regardless of error + } fs.symlinkSync(cycles, link, 'dir'); unlink.push(link); assertEqualPath(realpathSync(testPath), path.resolve(expected)); @@ -271,7 +287,9 @@ function test_relative_input_cwd(realpath, realpathSync, callback) { ].forEach(function(t) { const fn = t[0]; console.error('fn=%j', fn); - try { fs.unlinkSync(fn); } catch {} + try { fs.unlinkSync(fn); } catch { + // Continue regardless of error + } const b = path.basename(t[1]); const type = (b === 'root.js' ? 'file' : 'dir'); console.log('fs.symlinkSync(%j, %j, %j)', t[1], fn, type); @@ -309,8 +327,12 @@ function test_deep_symlink_mix(realpath, realpathSync, callback) { // $tmpDir/targets/cycles/root.js (hard) const entry = tmp('node-test-realpath-f1'); - try { fs.unlinkSync(tmp('node-test-realpath-d2/foo')); } catch {} - try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch {} + try { fs.unlinkSync(tmp('node-test-realpath-d2/foo')); } catch { + // Continue regardless of error + } + try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch { + // Continue regardless of error + } fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700); try { [ @@ -325,7 +347,9 @@ function test_deep_symlink_mix(realpath, realpathSync, callback) { [`${targetsAbsDir}/nested-index/two/realpath-c`, `${tmpDir}/cycles/root.js`], ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch {} + try { fs.unlinkSync(t[0]); } catch { + // Continue regardless of error + } fs.symlinkSync(t[1], t[0]); unlink.push(t[0]); }); @@ -479,14 +503,18 @@ function test_abs_with_kids(realpath, realpathSync, cb) { ['/a/b/c/x.txt', '/a/link', ].forEach(function(file) { - try { fs.unlinkSync(root + file); } catch {} + try { fs.unlinkSync(root + file); } catch { + // Continue regardless of error + } }); ['/a/b/c', '/a/b', '/a', '', ].forEach(function(folder) { - try { fs.rmdirSync(root + folder); } catch {} + try { fs.rmdirSync(root + folder); } catch { + // Continue regardless of error + } }); } diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js index 60df2c1d73f463..4b91a374215f02 100644 --- a/test/parallel/test-global.js +++ b/test/parallel/test-global.js @@ -36,7 +36,9 @@ builtinModules.forEach((moduleName) => { // This could throw for e.g., crypto if the binary is not compiled // accordingly. require(moduleName); - } catch {} + } catch { + // Continue regardless of error + } } }); diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js index f7931ec0dfa7e2..fce8873cab86e4 100644 --- a/test/parallel/test-http-outgoing-finish.js +++ b/test/parallel/test-http-outgoing-finish.js @@ -49,7 +49,9 @@ function write(out) { let endCb = false; // First, write until it gets some backpressure - while (out.write(buf, common.mustSucceed())) {} + while (out.write(buf, common.mustSucceed())) { + // empty + } // Now end, and make sure that we don't get the 'finish' event // before the tick where the cb gets called. We give it until diff --git a/test/parallel/test-http-outgoing-message-capture-rejection.js b/test/parallel/test-http-outgoing-message-capture-rejection.js index 9fe9bdb21331d8..d2e9eedb50886b 100644 --- a/test/parallel/test-http-outgoing-message-capture-rejection.js +++ b/test/parallel/test-http-outgoing-message-capture-rejection.js @@ -19,7 +19,9 @@ events.captureRejections = true; })); // Write until there is space in the buffer - while (res.write('hello')) {} + while (res.write('hello')) { + // empty + } })); server.listen(0, common.mustCall(() => { @@ -87,6 +89,8 @@ events.captureRejections = true; })); // Write until there is space in the buffer - while (req.write('hello')) {} + while (req.write('hello')) { + // empty + } })); } diff --git a/test/parallel/test-http2-server-socket-destroy.js b/test/parallel/test-http2-server-socket-destroy.js index ffb7ea48dc3343..2cbb1012d9ab2c 100644 --- a/test/parallel/test-http2-server-socket-destroy.js +++ b/test/parallel/test-http2-server-socket-destroy.js @@ -62,5 +62,7 @@ server.on('listening', common.mustCall(async () => { try { await once(req, 'end'); - } catch {} + } catch { + // Continue regardless of error + } })); diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index 81c07d1263e964..05c5d144db4646 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -69,7 +69,9 @@ function test() { process.kill(child.pid, 'SIGKILL'); try { parent.kill(); - } catch {} + } catch { + // Continue regardless of error + } assert.strictEqual(s, 'hello from child\n'); assert.strictEqual(res.statusCode, 200); diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index efa08323047358..c6e0c0eac56177 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -69,7 +69,9 @@ function test() { process.kill(child.pid, 'SIGKILL'); try { parent.kill(); - } catch {} + } catch { + // Continue regardless of error + } assert.strictEqual(s, 'hello from child\n'); assert.strictEqual(res.statusCode, 200); diff --git a/test/parallel/test-performance-eventlooputil.js b/test/parallel/test-performance-eventlooputil.js index 9ce7212729d574..eeac77b3c3840e 100644 --- a/test/parallel/test-performance-eventlooputil.js +++ b/test/parallel/test-performance-eventlooputil.js @@ -37,7 +37,9 @@ setTimeout(mustCall(function r() { return setTimeout(mustCall(r), 5); const t = Date.now(); - while (Date.now() - t < SPIN_DUR) { } + while (Date.now() - t < SPIN_DUR) { + // empty + } const elu2 = eventLoopUtilization(elu1); const elu3 = eventLoopUtilization(); diff --git a/test/parallel/test-process-uid-gid.js b/test/parallel/test-process-uid-gid.js index 0e170620b7f237..81c4ed88f672d8 100644 --- a/test/parallel/test-process-uid-gid.js +++ b/test/parallel/test-process-uid-gid.js @@ -53,10 +53,18 @@ assert.throws(() => { // Passing -0 shouldn't crash the process // Refs: https://github.com/nodejs/node/issues/32750 -try { process.setuid(-0); } catch {} -try { process.seteuid(-0); } catch {} -try { process.setgid(-0); } catch {} -try { process.setegid(-0); } catch {} +try { process.setuid(-0); } catch { + // Continue regardless of error +} +try { process.seteuid(-0); } catch { + // Continue regardless of error +} +try { process.setgid(-0); } catch { + // Continue regardless of error +} +try { process.setegid(-0); } catch { + // Continue regardless of error +} // If we're not running as super user... if (process.getuid() !== 0) { diff --git a/test/parallel/test-repl-require-after-write.js b/test/parallel/test-repl-require-after-write.js index 83c464473589e0..02dff78fccdfce 100644 --- a/test/parallel/test-repl-require-after-write.js +++ b/test/parallel/test-repl-require-after-write.js @@ -14,7 +14,9 @@ const requirePath = JSON.stringify(path.join(tmpdir.path, 'non-existent.json')); const child = spawn(process.execPath, ['-i']); let out = ''; -const input = `try { require(${requirePath}); } catch {} ` + +const input = `try { require(${requirePath}); } catch { + // Continue regardless of error +} ` + `require('fs').writeFileSync(${requirePath}, '1');` + `require(${requirePath});`; diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index 014a304d3f0263..7b6e8d22755acb 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -19,7 +19,9 @@ function test(size, useBuffer, cb) { try { fs.unlinkSync(tmpFile); - } catch {} + } catch { + // Continue regardless of error + } console.log(`${size} chars to ${tmpFile}...`); diff --git a/test/parallel/test-stream-pipeline-uncaught.js b/test/parallel/test-stream-pipeline-uncaught.js index bfac4f1fee8d0b..2011a887650fa6 100644 --- a/test/parallel/test-stream-pipeline-uncaught.js +++ b/test/parallel/test-stream-pipeline-uncaught.js @@ -16,7 +16,9 @@ process.on('uncaughtException', common.mustCall((err) => { const s = new PassThrough(); s.end('data'); pipeline(s, async function(source) { - for await (const chunk of source) {} // eslint-disable-line no-unused-vars + for await (const chunk of source) { // eslint-disable-line no-unused-vars + // empty + } }, common.mustSucceed(() => { throw new Error('error'); })); diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index 192f971b29daca..070c91ec1dda43 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -700,7 +700,9 @@ const tsp = require('timers/promises'); await Promise.resolve(); yield 'hello'; }, async function*(source) { // eslint-disable-line require-yield - for await (const chunk of source) {} // eslint-disable-line no-unused-vars + for await (const chunk of source) { // eslint-disable-line no-unused-vars + // empty + } }, common.mustCall((err) => { assert.strictEqual(err, undefined); })); @@ -716,7 +718,9 @@ const tsp = require('timers/promises'); await Promise.resolve(); throw new Error('kaboom'); }, async function*(source) { // eslint-disable-line require-yield - for await (const chunk of source) {} // eslint-disable-line no-unused-vars + for await (const chunk of source) { // eslint-disable-line no-unused-vars + // empty + } }, common.mustCall((err) => { assert.strictEqual(err.message, 'kaboom'); })); diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index 45b27a155d0efd..e44e3d11bd0ae0 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -244,7 +244,9 @@ async function tests() { let err; try { // eslint-disable-next-line no-unused-vars - for await (const k of readable) {} + for await (const k of readable) { + // empty + } } catch (e) { err = e; } @@ -463,9 +465,11 @@ async function tests() { }); // eslint-disable-next-line no-unused-vars for await (const a of r) { + // empty } // eslint-disable-next-line no-unused-vars for await (const b of r) { + // empty } } @@ -616,7 +620,9 @@ async function tests() { } }); - for await (const chunk of r) {} // eslint-disable-line no-unused-vars + for await (const chunk of r) { // eslint-disable-line no-unused-vars + // empty + } assert.strictEqual(r.destroyed, false); } @@ -649,8 +655,9 @@ async function tests() { assert.strictEqual(r.destroyed, false); }); - for await (const chunk of r) {} // eslint-disable-line no-unused-vars - + for await (const chunk of r) { // eslint-disable-line no-unused-vars + // empty + } assert.strictEqual(r.destroyed, true); } } @@ -813,7 +820,9 @@ async function tests() { let _err; try { // eslint-disable-next-line no-unused-vars - for await (const chunk of res) {} + for await (const chunk of res) { + // empty + } } catch (err) { _err = err; } diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index 51f4521686e70d..05463189a3092d 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -317,7 +317,9 @@ const assert = require('assert'); })); assert.rejects((async () => { /* eslint-disable-next-line no-unused-vars */ - for await (const chunk of read) {} + for await (const chunk of read) { + // empty + } })(), /AbortError/); setTimeout(() => controller.abort(), 0); } diff --git a/test/parallel/test-stream-readable-reading-readingMore.js b/test/parallel/test-stream-readable-reading-readingMore.js index f616b460488e75..f756cf23839656 100644 --- a/test/parallel/test-stream-readable-reading-readingMore.js +++ b/test/parallel/test-stream-readable-reading-readingMore.js @@ -41,7 +41,9 @@ const Readable = require('stream').Readable; assert.strictEqual(state.ended, !state.reading); // Consume all the data - while (readable.read() !== null) {} + while (readable.read() !== null) { + // empty + } if (expectedReadingMore.length === 0) // Reached end of stream process.nextTick(common.mustCall(onStreamEnd, 1)); diff --git a/test/parallel/test-timers-interval-promisified.js b/test/parallel/test-timers-interval-promisified.js index 9c11a9d9870fa7..3dabe27cdad4ca 100644 --- a/test/parallel/test-timers-interval-promisified.js +++ b/test/parallel/test-timers-interval-promisified.js @@ -252,7 +252,9 @@ process.on('multipleResolves', common.mustNotCall()); try { const iterable = timerPromises.setInterval(2, undefined, { signal }); // eslint-disable-next-line no-unused-vars - for await (const _ of iterable) {} + for await (const _ of iterable) { + // empty + } assert.fail('should have failed'); } catch (err) { assert.strictEqual(err.cause, 'boom'); diff --git a/test/parallel/test-vm-parse-abort-on-uncaught-exception.js b/test/parallel/test-vm-parse-abort-on-uncaught-exception.js index 4fcff30321f671..2864be5a0f8a51 100644 --- a/test/parallel/test-vm-parse-abort-on-uncaught-exception.js +++ b/test/parallel/test-vm-parse-abort-on-uncaught-exception.js @@ -7,8 +7,12 @@ const vm = require('vm'); try { new vm.Script({ toString() { throw new Error('foo'); } }, {}); -} catch {} +} catch { + // Continue regardless of error +} try { new vm.Script('[', {}); -} catch {} +} catch { + // Continue regardless of error +} diff --git a/test/parallel/test-whatwg-readablebytestream.js b/test/parallel/test-whatwg-readablebytestream.js index eb4355505053ef..dd804ff212822d 100644 --- a/test/parallel/test-whatwg-readablebytestream.js +++ b/test/parallel/test-whatwg-readablebytestream.js @@ -232,7 +232,3 @@ class Source { code: 'ERR_INVALID_STATE', }); } - -{ - -} diff --git a/test/pseudo-tty/test-trace-sigint.js b/test/pseudo-tty/test-trace-sigint.js index 8b539bfc88d7b8..1f495126957300 100644 --- a/test/pseudo-tty/test-trace-sigint.js +++ b/test/pseudo-tty/test-trace-sigint.js @@ -26,5 +26,7 @@ function main() { // Deactivate colors even if the tty does support colors. process.env.NODE_DISABLE_COLORS = '1'; process.kill(process.pid, 'SIGINT'); - while (true) {} + while (true) { + // empty + } } diff --git a/test/pummel/test-policy-integrity-dep.js b/test/pummel/test-policy-integrity-dep.js index 42948ce896e151..1954a7a76b6ab7 100644 --- a/test/pummel/test-policy-integrity-dep.js +++ b/test/pummel/test-policy-integrity-dep.js @@ -196,7 +196,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -282,8 +284,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -301,8 +302,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } } @@ -324,8 +324,7 @@ for (const permutation of permutations({ } else if (permutation.packageIntegrity === 'missing') { packageIntegrities = []; shouldSucceed = false; - } else if (permutation.packageIntegrity === 'match') { - } else { + } else if (permutation.packageIntegrity !== 'match') { throw new Error('unreachable'); } resources['./package.json'] = { diff --git a/test/pummel/test-policy-integrity-parent-commonjs.js b/test/pummel/test-policy-integrity-parent-commonjs.js index 9ea62e4423219c..1dfb961b0226f4 100644 --- a/test/pummel/test-policy-integrity-parent-commonjs.js +++ b/test/pummel/test-policy-integrity-parent-commonjs.js @@ -197,7 +197,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -273,8 +275,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -291,8 +292,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } @@ -312,8 +312,7 @@ for (const permutation of permutations({ } else if (permutation.packageIntegrity === 'missing') { packageIntegrities = []; shouldSucceed = false; - } else if (permutation.packageIntegrity === 'match') { - } else { + } else if (permutation.packageIntegrity !== 'match') { throw new Error('unreachable'); } resources['./package.json'] = { diff --git a/test/pummel/test-policy-integrity-parent-module.js b/test/pummel/test-policy-integrity-parent-module.js index aed2528bbeeb5c..3d70f17be0d2e0 100644 --- a/test/pummel/test-policy-integrity-parent-module.js +++ b/test/pummel/test-policy-integrity-parent-module.js @@ -197,7 +197,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -273,8 +275,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -291,8 +292,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } @@ -312,8 +312,7 @@ for (const permutation of permutations({ } else if (permutation.packageIntegrity === 'missing') { packageIntegrities = []; shouldSucceed = false; - } else if (permutation.packageIntegrity === 'match') { - } else { + } else if (permutation.packageIntegrity !== 'match') { throw new Error('unreachable'); } resources['./package.json'] = { diff --git a/test/pummel/test-policy-integrity-parent-no-package-json.js b/test/pummel/test-policy-integrity-parent-no-package-json.js index c00a5e31921efc..ba131047603d0a 100644 --- a/test/pummel/test-policy-integrity-parent-no-package-json.js +++ b/test/pummel/test-policy-integrity-parent-no-package-json.js @@ -197,7 +197,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -269,8 +271,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -287,8 +288,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } diff --git a/test/pummel/test-policy-integrity-worker-commonjs.js b/test/pummel/test-policy-integrity-worker-commonjs.js index 6ddcb74c9dae40..4fa791f010067c 100644 --- a/test/pummel/test-policy-integrity-worker-commonjs.js +++ b/test/pummel/test-policy-integrity-worker-commonjs.js @@ -214,7 +214,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -290,8 +292,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -308,8 +309,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } @@ -335,8 +335,7 @@ for (const permutation of permutations({ } else if (permutation.packageIntegrity === 'missing') { packageIntegrities = []; shouldSucceed = false; - } else if (permutation.packageIntegrity === 'match') { - } else { + } else if (permutation.packageIntegrity !== 'match') { throw new Error('unreachable'); } resources['./package.json'] = { diff --git a/test/pummel/test-policy-integrity-worker-module.js b/test/pummel/test-policy-integrity-worker-module.js index 69a7fb448283c3..0fb0bb88000a39 100644 --- a/test/pummel/test-policy-integrity-worker-module.js +++ b/test/pummel/test-policy-integrity-worker-module.js @@ -214,7 +214,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -290,8 +292,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -308,8 +309,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } @@ -334,8 +334,7 @@ for (const permutation of permutations({ } else if (permutation.packageIntegrity === 'missing') { packageIntegrities = []; shouldSucceed = false; - } else if (permutation.packageIntegrity === 'match') { - } else { + } else if (permutation.packageIntegrity !== 'match') { throw new Error('unreachable'); } resources['./package.json'] = { diff --git a/test/pummel/test-policy-integrity-worker-no-package-json.js b/test/pummel/test-policy-integrity-worker-no-package-json.js index 909e58be5650d6..b17c3a2272bf9c 100644 --- a/test/pummel/test-policy-integrity-worker-no-package-json.js +++ b/test/pummel/test-policy-integrity-worker-no-package-json.js @@ -214,7 +214,9 @@ function drainQueue() { const enoentFilepath = path.join(tmpdir.path, 'enoent'); try { fs.unlinkSync(enoentFilepath); - } catch { } + } catch { + // Continue regardless of error + } const { status } = spawnSync( process.execPath, ['--experimental-policy', enoentFilepath, '-e', ''], @@ -286,8 +288,7 @@ for (const permutation of permutations({ } else if (permutation.depIntegrity === 'missing') { resources[depPath].integrities = null; shouldSucceed = false; - } else if (permutation.depIntegrity === 'match') { - } else { + } else if (permutation.depIntegrity !== 'match') { throw new Error('unreachable'); } if (parentFormat !== 'commonjs') { @@ -304,8 +305,7 @@ for (const permutation of permutations({ } else if (permutation.parentIntegrity === 'missing') { resources[parentPath].integrities = null; shouldSucceed = false; - } else if (permutation.parentIntegrity === 'match') { - } else { + } else if (permutation.parentIntegrity !== 'match') { throw new Error('unreachable'); } diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index 419b4171d226e9..dc93e91d11eb9c 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -39,6 +39,7 @@ const interval = setInterval(function() { try { vm.runInNewContext('throw 1;'); } catch { + // Continue regardless of error } global.gc(); diff --git a/test/sequential/test-net-response-size.js b/test/sequential/test-net-response-size.js index c5d7e9b600e05d..ba86531a29bc8f 100644 --- a/test/sequential/test-net-response-size.js +++ b/test/sequential/test-net-response-size.js @@ -65,7 +65,9 @@ if (process.argv[2] === 'server') { // Block the event loop for 1 second const start = (new Date()).getTime(); - while ((new Date()).getTime() < start + 1000) {} + while ((new Date()).getTime() < start + 1000) { + // empty + } client.write(alittle);