Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-watch-file.js #10679

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ 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) {
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