Skip to content

Commit 17d9a73

Browse files
sivaprsitaloacasas
authored andcommitted
test: refactor test-watch-file.js
* use const and let instead of var * use arrow function * removed console.log statements PR-URL: #10679 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 8ba2cf9 commit 17d9a73

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/pummel/test-watch-file.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ var assert = require('assert');
55
var fs = require('fs');
66
var path = require('path');
77

8-
var f = path.join(common.fixturesDir, 'x.txt');
8+
const f = path.join(common.fixturesDir, 'x.txt');
99

10-
console.log('watching for changes of ' + f);
11-
12-
var changes = 0;
10+
let changes = 0;
1311
function watchFile() {
14-
fs.watchFile(f, function(curr, prev) {
15-
console.log(f + ' change');
12+
fs.watchFile(f, (curr, prev) => {
1613
changes++;
1714
assert.notDeepStrictEqual(curr.mtime, prev.mtime);
1815
fs.unwatchFile(f);
@@ -24,7 +21,7 @@ function watchFile() {
2421
watchFile();
2522

2623

27-
var fd = fs.openSync(f, 'w+');
24+
const fd = fs.openSync(f, 'w+');
2825
fs.writeSync(fd, 'xyz\n');
2926
fs.closeSync(fd);
3027

0 commit comments

Comments
 (0)