From f49e63e11e1d68a8a230771197019e035d30e2a3 Mon Sep 17 00:00:00 2001 From: sivaprasanna Date: Sat, 7 Jan 2017 23:10:16 +0530 Subject: [PATCH 1/2] test: refactor test-watch-file.js * use const and let instead of var * use arrow function --- test/pummel/test-watch-file.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index 0f6f2d5fc8eed2..94602f244fda8a 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -5,13 +5,13 @@ const assert = require('assert'); const fs = require('fs'); const 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) { + fs.watchFile(f, (curr, prev) => { console.log(f + ' change'); changes++; assert.notDeepStrictEqual(curr.mtime, prev.mtime); @@ -24,7 +24,7 @@ function watchFile() { watchFile(); -var fd = fs.openSync(f, 'w+'); +const fd = fs.openSync(f, 'w+'); fs.writeSync(fd, 'xyz\n'); fs.closeSync(fd); From 86fc4f9a81b6be088f6f15e6b3883e98dc548a1e Mon Sep 17 00:00:00 2001 From: sivaprasanna Date: Mon, 9 Jan 2017 22:23:40 +0530 Subject: [PATCH 2/2] test: refactor the code in test/pummel/test-watch-file.js removed the console.log statements --- test/pummel/test-watch-file.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index 94602f244fda8a..90909875d74a15 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -7,12 +7,9 @@ const path = require('path'); const f = path.join(common.fixturesDir, 'x.txt'); -console.log('watching for changes of ' + f); - let changes = 0; function watchFile() { fs.watchFile(f, (curr, prev) => { - console.log(f + ' change'); changes++; assert.notDeepStrictEqual(curr.mtime, prev.mtime); fs.unwatchFile(f);