Skip to content

Commit

Permalink
test: refactor test-watch-file.js
Browse files Browse the repository at this point in the history
* use const and let instead of var
* use arrow function
* removed console.log statements

PR-URL: #10679
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
sivaprs authored and italoacasas committed Jan 27, 2017
1 parent 8ba2cf9 commit 17d9a73
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/pummel/test-watch-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit 17d9a73

Please sign in to comment.