From d9877017b18055e164efd7c4ac1ec98571dbb923 Mon Sep 17 00:00:00 2001 From: sagirk Date: Mon, 19 Nov 2018 11:56:32 +0530 Subject: [PATCH] test: replace anonymous closure functions with arrow functions In `test/parallel/test-fs-truncate-fd.js`, callbacks use anonymous closure functions. It is safe to replace them with arrow functions since these callbacks don't alter their context (`this`). This results in shorter functions. PR-URL: https://github.com/nodejs/node/pull/24478 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig --- test/parallel/test-fs-truncate-fd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-truncate-fd.js b/test/parallel/test-fs-truncate-fd.js index 62634aed1d91a7..f71d511f5da057 100644 --- a/test/parallel/test-fs-truncate-fd.js +++ b/test/parallel/test-fs-truncate-fd.js @@ -16,12 +16,12 @@ const msg = 'Using fs.truncate with a file descriptor is deprecated.' + common.expectWarning('DeprecationWarning', msg, 'DEP0081'); -fs.truncate(fd, 5, common.mustCall(function(err) { +fs.truncate(fd, 5, common.mustCall((err) => { assert.ok(!err); assert.strictEqual(fs.readFileSync(filename, 'utf8'), 'hello'); })); -process.on('exit', function() { +process.on('exit', () => { fs.closeSync(fd); fs.unlinkSync(filename); console.log('ok');