From a35bcd5ef5e2ec4b5a066db3bca4b487a0c3fd24 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 4 Nov 2018 10:25:02 -0500 Subject: [PATCH] test: remove unused catch bindings PR-URL: https://github.com/nodejs/node/pull/24079 Reviewed-By: Sam Roberts Reviewed-By: Wyatt Preul --- test/common/index.js | 8 +++--- test/doctool/test-doctool-html.js | 2 +- test/doctool/test-doctool-json.js | 2 +- test/fixtures/catch-stdout-error.js | 2 +- .../test-dgram-broadcast-multi-process.js | 2 +- .../test-dgram-multicast-multi-process.js | 2 +- .../test-url-parse-conformance.js | 4 +-- test/message/vm_dont_display_runtime_error.js | 2 +- test/message/vm_dont_display_syntax_error.js | 2 +- test/parallel/test-assert.js | 2 +- test/parallel/test-crypto-cipher-decipher.js | 12 ++++---- test/parallel/test-file-write-stream2.js | 2 +- test/parallel/test-fs-realpath-pipe.js | 2 +- test/parallel/test-fs-realpath.js | 28 +++++++++---------- .../test-listen-fd-detached-inherit.js | 2 +- test/parallel/test-listen-fd-detached.js | 2 +- test/parallel/test-listen-fd-ebadf.js | 2 +- test/parallel/test-module-loading-error.js | 2 +- .../test-promises-unhandled-rejections.js | 2 +- .../test-repl-syntax-error-handling.js | 2 +- .../parallel/test-require-deps-deprecation.js | 2 +- test/parallel/test-stdout-close-catch.js | 2 +- test/parallel/test-stdout-to-file.js | 2 +- test/parallel/test-vm-low-stack-space.js | 4 +-- test/parallel/test-vm-module-errors.js | 4 +-- ...st-vm-parse-abort-on-uncaught-exception.js | 4 +-- test/pummel/test-fs-watch-non-recursive.js | 6 ++-- test/pummel/test-vm-memleak.js | 2 +- test/pummel/test-vm-race.js | 2 +- .../test-fs-readfile-tostring-fail.js | 2 +- 30 files changed, 57 insertions(+), 57 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 768570437a7d85..da5027af135f0e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -372,7 +372,7 @@ function canCreateSymLink() { try { const output = execSync(`${whoamiPath} /priv`, { timout: 1000 }); return output.includes('SeCreateSymbolicLinkPrivilege'); - } catch (e) { + } catch { return false; } } @@ -456,7 +456,7 @@ function isAlive(pid) { try { process.kill(pid, 'SIGCONT'); return true; - } catch (e) { + } catch { return false; } } @@ -665,7 +665,7 @@ function getTTYfd() { if (ttyFd === undefined) { try { return fs.openSync('/dev/tty'); - } catch (e) { + } catch { // There aren't any tty fd's available to use. return -1; } @@ -679,7 +679,7 @@ function runWithInvalidFD(func) { // be an valid one. try { while (fs.fstatSync(fd--) && fd > 0); - } catch (e) { + } catch { return func(fd); } diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 78f48ae54e8f26..499034cd8a3684 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -4,7 +4,7 @@ const common = require('../common'); // The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree. try { require('../../tools/node_modules/eslint/node_modules/js-yaml'); -} catch (e) { +} catch { common.skip('missing js-yaml (eslint not present)'); } diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index cdd3664cf1c33a..7471a2e1f0693d 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -4,7 +4,7 @@ const common = require('../common'); // The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree. try { require('../../tools/node_modules/eslint/node_modules/js-yaml'); -} catch (e) { +} catch { common.skip('missing js-yaml (eslint not present)'); } diff --git a/test/fixtures/catch-stdout-error.js b/test/fixtures/catch-stdout-error.js index bdd09b5ab8f450..5e30326bf9b4c9 100644 --- a/test/fixtures/catch-stdout-error.js +++ b/test/fixtures/catch-stdout-error.js @@ -22,7 +22,7 @@ function write() { try { process.stdout.write('Hello, world\n'); - } catch (ex) { + } catch { throw new Error('this should never happen'); } setImmediate(function() { diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index c30059e739b687..a8d97869703e58 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch (e) {} + try { sendSocket.close(); } catch {} return; } diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js index e6e7a44fcd4de2..9d2e2c9f3ffd84 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -170,7 +170,7 @@ if (process.argv[2] !== 'child') { const buf = messages[i++]; if (!buf) { - try { sendSocket.close(); } catch (e) {} + try { sendSocket.close(); } catch {} return; } diff --git a/test/known_issues/test-url-parse-conformance.js b/test/known_issues/test-url-parse-conformance.js index 022a613a226549..fe3aa718eaf891 100644 --- a/test/known_issues/test-url-parse-conformance.js +++ b/test/known_issues/test-url-parse-conformance.js @@ -40,12 +40,12 @@ tests.forEach((test) => { assert.strictEqual(test.pathname, parsed.pathname || '/'); assert.strictEqual(test.search, parsed.search || ''); assert.strictEqual(test.hash, parsed.hash || ''); - } catch (err) { + } catch { // For now, we're just interested in the number of failures. failed++; } } - } catch (err) { + } catch { // If Parse failed and it wasn't supposed to, treat it as a failure. if (!test.failure) failed++; diff --git a/test/message/vm_dont_display_runtime_error.js b/test/message/vm_dont_display_runtime_error.js index e7c77081a597c6..72568a21c7c339 100644 --- a/test/message/vm_dont_display_runtime_error.js +++ b/test/message/vm_dont_display_runtime_error.js @@ -30,7 +30,7 @@ try { filename: 'test.vm', displayErrors: false }); -} catch (e) {} +} catch {} console.error('middle'); diff --git a/test/message/vm_dont_display_syntax_error.js b/test/message/vm_dont_display_syntax_error.js index f3965b33430e78..7e588c5095741a 100644 --- a/test/message/vm_dont_display_syntax_error.js +++ b/test/message/vm_dont_display_syntax_error.js @@ -30,7 +30,7 @@ try { filename: 'test.vm', displayErrors: false }); -} catch (e) {} +} catch {} console.error('middle'); diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 8e6c2e52b5be55..e5a7d1aaaa90d8 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -168,7 +168,7 @@ assert.throws( }, Array ); - } catch (e) { + } catch { threw = true; } assert.ok(threw, 'wrong constructor validation'); diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index 3c0658762f478b..ed387c3c999026 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -168,13 +168,13 @@ testCipher2(Buffer.from('0123456789abcdef')); // not assert. See https://github.com/nodejs/node-v0.x-archive/issues/4886. { const c = crypto.createCipher('aes-256-cbc', 'secret'); - try { c.final('xxx'); } catch (e) { /* Ignore. */ } - try { c.final('xxx'); } catch (e) { /* Ignore. */ } - try { c.final('xxx'); } catch (e) { /* Ignore. */ } + try { c.final('xxx'); } catch { /* Ignore. */ } + try { c.final('xxx'); } catch { /* Ignore. */ } + try { c.final('xxx'); } catch { /* Ignore. */ } const d = crypto.createDecipher('aes-256-cbc', 'secret'); - try { d.final('xxx'); } catch (e) { /* Ignore. */ } - try { d.final('xxx'); } catch (e) { /* Ignore. */ } - try { d.final('xxx'); } catch (e) { /* Ignore. */ } + try { d.final('xxx'); } catch { /* Ignore. */ } + try { d.final('xxx'); } catch { /* Ignore. */ } + try { d.final('xxx'); } catch { /* Ignore. */ } } // Regression test for https://github.com/nodejs/node-v0.x-archive/issues/5482: diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index 2db06640e18dba..e29bd80ebf792c 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -56,7 +56,7 @@ process.on('exit', function() { function removeTestFile() { try { fs.unlinkSync(filepath); - } catch (e) {} + } catch {} } diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js index 55010cf78b4a5a..7104e93ff123ed 100644 --- a/test/parallel/test-fs-realpath-pipe.js +++ b/test/parallel/test-fs-realpath-pipe.js @@ -22,7 +22,7 @@ for (const code of [ if (require('fs').realpathSync('/dev/stdin')) { process.exit(2); } - } catch (e) { + } catch { process.exit(1); }` ]) { diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 599616f5224eb7..18b9de471bc3a8 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -100,7 +100,7 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) { [ [entry, `../${path.basename(tmpDir)}/cycles/root.js`] ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch (e) {} + try { fs.unlinkSync(t[0]); } catch {} console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file'); fs.symlinkSync(t[1], t[0], 'file'); unlink.push(t[0]); @@ -126,7 +126,7 @@ function test_simple_absolute_symlink(realpath, realpathSync, callback) { [ [entry, expected] ].forEach(function(t) { - try { fs.unlinkSync(t[0]); } catch (e) {} + try { fs.unlinkSync(t[0]); } catch {} console.error('fs.symlinkSync(%j, %j, %j)', t[1], t[0], type); fs.symlinkSync(t[1], t[0], type); unlink.push(t[0]); @@ -151,13 +151,13 @@ 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 (e) {} + try { fs.unlinkSync(linkPath1); } catch {} 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 (e) {} + try { fs.unlinkSync(entry); } catch {} fs.symlinkSync(linkData2, entry, 'file'); unlink.push(linkPath1); unlink.push(entry); @@ -178,13 +178,13 @@ 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 (e) {} + try { fs.unlinkSync(linkPath1b); } catch {} 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 (e) {} + try { fs.unlinkSync(entry); } catch {} fs.symlinkSync(linkData2b, entry, 'dir'); unlink.push(linkPath1b); unlink.push(entry); @@ -208,7 +208,7 @@ 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 (e) {} + try { fs.unlinkSync(t[0]); } catch {} fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); @@ -235,7 +235,7 @@ 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 (ex) {} + try { fs.unlinkSync(link); } catch {} fs.symlinkSync(cycles, link, 'dir'); unlink.push(link); assertEqualPath(realpathSync(testPath), path.resolve(expected)); @@ -263,7 +263,7 @@ 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 (e) {} + try { fs.unlinkSync(fn); } catch {} const b = path.basename(t[1]); const type = (b === 'root.js' ? 'file' : 'dir'); console.log('fs.symlinkSync(%j, %j, %j)', t[1], fn, type); @@ -302,8 +302,8 @@ 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 (e) {} - try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch (e) {} + try { fs.unlinkSync(tmp('node-test-realpath-d2/foo')); } catch {} + try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch {} fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700); try { [ @@ -318,7 +318,7 @@ 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 (e) {} + try { fs.unlinkSync(t[0]); } catch {} fs.symlinkSync(t[1], t[0]); unlink.push(t[0]); }); @@ -429,14 +429,14 @@ function test_abs_with_kids(realpath, realpathSync, cb) { ['/a/b/c/x.txt', '/a/link' ].forEach(function(file) { - try { fs.unlinkSync(root + file); } catch (ex) {} + try { fs.unlinkSync(root + file); } catch {} }); ['/a/b/c', '/a/b', '/a', '' ].forEach(function(folder) { - try { fs.rmdirSync(root + folder); } catch (ex) {} + try { fs.rmdirSync(root + folder); } catch {} }); } function setup() { diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index b4fce58c93390d..4feb7dc3ab03dd 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -69,7 +69,7 @@ function test() { process.kill(child.pid, 'SIGKILL'); try { parent.kill(); - } catch (e) {} + } catch {} 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 6fbc938324549e..09d7f8b6c1a68c 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -69,7 +69,7 @@ function test() { process.kill(child.pid, 'SIGKILL'); try { parent.kill(); - } catch (e) {} + } catch {} assert.strictEqual(s, 'hello from child\n'); assert.strictEqual(res.statusCode, 200); diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js index 564dea7f951a1a..3ec40b5c23a1f2 100644 --- a/test/parallel/test-listen-fd-ebadf.js +++ b/test/parallel/test-listen-fd-ebadf.js @@ -34,7 +34,7 @@ let invalidFd = 2; // Get first known bad file descriptor. try { while (fs.fstatSync(++invalidFd)); -} catch (e) { +} catch { // do nothing; we now have an invalid fd } diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 86932bd759d20c..f2351e708f2e93 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -45,7 +45,7 @@ if (common.isWindows) { try { // If MUI != 'en' we'll ignore the content of the message localeOk = execSync(powerShellFindMUI).toString('utf8').trim() === 'en'; - } catch (_) { + } catch { // It's only a best effort try to find the MUI } } diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index d336630f7cf8ce..93ac186a3b45f6 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -681,7 +681,7 @@ asyncTest('Throwing an error inside a rejectionHandled handler goes to' + setTimeout(function() { try { p.catch(function() {}); - } catch (e) { + } catch { done(new Error('fail')); } }, 1); diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index f61ab077eb638c..91a8614d1deb93 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -63,7 +63,7 @@ function child() { let caught; try { vm.runInThisContext('haf!@##&$!@$*!@', { displayErrors: false }); - } catch (er) { + } catch { caught = true; } assert(caught); diff --git a/test/parallel/test-require-deps-deprecation.js b/test/parallel/test-require-deps-deprecation.js index 80bf66d7f6b74f..5bee24a5db19ce 100644 --- a/test/parallel/test-require-deps-deprecation.js +++ b/test/parallel/test-require-deps-deprecation.js @@ -34,7 +34,7 @@ common.expectWarning('DeprecationWarning', deprecatedModules.map((m) => { for (const m of deprecatedModules) { try { require(m); - } catch (err) {} + } catch {} } // Instead of checking require, check that resolve isn't pointing toward a diff --git a/test/parallel/test-stdout-close-catch.js b/test/parallel/test-stdout-close-catch.js index e9b559c9f24cd0..6c0db3ea904a7d 100644 --- a/test/parallel/test-stdout-close-catch.js +++ b/test/parallel/test-stdout-close-catch.js @@ -27,7 +27,7 @@ child.stderr.on('data', function(c) { child.on('close', common.mustCall(function(code) { try { output = JSON.parse(output); - } catch (er) { + } catch { console.error(output); process.exit(1); } diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index a02531ca41fbdb..f23bbea279d324 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -19,7 +19,7 @@ function test(size, useBuffer, cb) { try { fs.unlinkSync(tmpFile); - } catch (e) {} + } catch {} console.log(`${size} chars to ${tmpFile}...`); diff --git a/test/parallel/test-vm-low-stack-space.js b/test/parallel/test-vm-low-stack-space.js index 7c1313d47c1ad9..6a49a983d54f5e 100644 --- a/test/parallel/test-vm-low-stack-space.js +++ b/test/parallel/test-vm-low-stack-space.js @@ -6,7 +6,7 @@ const vm = require('vm'); function a() { try { return a(); - } catch (e) { + } catch { // Throw an exception as near to the recursion-based RangeError as possible. return vm.runInThisContext('() => 42')(); } @@ -17,7 +17,7 @@ assert.strictEqual(a(), 42); function b() { try { return b(); - } catch (e) { + } catch { // This writes a lot of noise to stderr, but it still works. return vm.runInNewContext('() => 42')(); } diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 05022160832a53..a343a542a10abd 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -98,7 +98,7 @@ async function checkModuleState() { const m = new SourceTextModule('import "foo";'); try { await m.link(common.mustCall(() => ({}))); - } catch (err) { + } catch { assert.strictEqual(m.linkingStatus, 'errored'); m.instantiate(); } @@ -219,7 +219,7 @@ async function checkLinking() { const erroredModule = new SourceTextModule('import "foo";'); try { await erroredModule.link(common.mustCall(() => ({}))); - } catch (err) { + } catch { // ignored } finally { assert.strictEqual(erroredModule.linkingStatus, 'errored'); 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 36f73ea676e5a5..4fcff30321f671 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,8 @@ const vm = require('vm'); try { new vm.Script({ toString() { throw new Error('foo'); } }, {}); -} catch (err) {} +} catch {} try { new vm.Script('[', {}); -} catch (err) {} +} catch {} diff --git a/test/pummel/test-fs-watch-non-recursive.js b/test/pummel/test-fs-watch-non-recursive.js index 2b10f9b24da746..da11b423a686e0 100644 --- a/test/pummel/test-fs-watch-non-recursive.js +++ b/test/pummel/test-fs-watch-non-recursive.js @@ -31,13 +31,13 @@ const testsubdir = path.join(testDir, 'testsubdir'); const filepath = path.join(testsubdir, 'watch.txt'); function cleanup() { - try { fs.unlinkSync(filepath); } catch (e) { } - try { fs.rmdirSync(testsubdir); } catch (e) { } + try { fs.unlinkSync(filepath); } catch { } + try { fs.rmdirSync(testsubdir); } catch { } } process.on('exit', cleanup); cleanup(); -try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {} +try { fs.mkdirSync(testsubdir, 0o700); } catch {} // Need a grace period, else the mkdirSync() above fires off an event. setTimeout(function() { diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index cb96512d384556..94e4055a767096 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -37,7 +37,7 @@ assert(ok, 'Run this test with --max_old_space_size=32.'); const interval = setInterval(function() { try { vm.runInNewContext('throw 1;'); - } catch (e) { + } catch { } const rss = process.memoryUsage().rss; diff --git a/test/pummel/test-vm-race.js b/test/pummel/test-vm-race.js index 7f9514b04e9e73..55f63d31689fb5 100644 --- a/test/pummel/test-vm-race.js +++ b/test/pummel/test-vm-race.js @@ -25,7 +25,7 @@ do { try { script.runInContext(context, { timeout: 5 }); ++sandbox.timeout; - } catch (err) { + } catch { --sandbox.timeout; } } while (Date.now() < giveUp); diff --git a/test/sequential/test-fs-readfile-tostring-fail.js b/test/sequential/test-fs-readfile-tostring-fail.js index 8dcab75e0fb119..da8f3930f618f9 100644 --- a/test/sequential/test-fs-readfile-tostring-fail.js +++ b/test/sequential/test-fs-readfile-tostring-fail.js @@ -50,7 +50,7 @@ stream.on('finish', common.mustCall(function() { function destroy() { try { fs.unlinkSync(file); - } catch (err) { + } catch { // it may not exist } }