From d469965cd4d0c13f71f5e6c70a2a35c2b7e1d340 Mon Sep 17 00:00:00 2001 From: sivaprasanna Date: Sat, 7 Jan 2017 23:10:16 +0530 Subject: [PATCH] test: refactor test-watch-file.js * use const and let instead of var * use arrow function * removed console.log statements PR-URL: https://github.com/nodejs/node/pull/10679 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Italo A. Casas Reviewed-By: Sakthipriyan Vairamani --- test/pummel/test-watch-file.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index 8fdf6b32b2d78c..8b79ef8ede4a63 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -5,14 +5,11 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); -var f = path.join(common.fixturesDir, 'x.txt'); +const f = path.join(common.fixturesDir, 'x.txt'); -console.log('watching for changes of ' + f); - -var changes = 0; +let changes = 0; function watchFile() { - fs.watchFile(f, function(curr, prev) { - console.log(f + ' change'); + fs.watchFile(f, (curr, prev) => { changes++; assert.notDeepStrictEqual(curr.mtime, prev.mtime); fs.unwatchFile(f); @@ -24,7 +21,7 @@ function watchFile() { watchFile(); -var fd = fs.openSync(f, 'w+'); +const fd = fs.openSync(f, 'w+'); fs.writeSync(fd, 'xyz\n'); fs.closeSync(fd);