mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
a799854ce9
* 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 <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>
31 lines
568 B
JavaScript
31 lines
568 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const f = path.join(common.fixturesDir, 'x.txt');
|
|
|
|
let changes = 0;
|
|
function watchFile() {
|
|
fs.watchFile(f, (curr, prev) => {
|
|
changes++;
|
|
assert.notDeepStrictEqual(curr.mtime, prev.mtime);
|
|
fs.unwatchFile(f);
|
|
watchFile();
|
|
fs.unwatchFile(f);
|
|
});
|
|
}
|
|
|
|
watchFile();
|
|
|
|
|
|
const fd = fs.openSync(f, 'w+');
|
|
fs.writeSync(fd, 'xyz\n');
|
|
fs.closeSync(fd);
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(changes > 0);
|
|
});
|