node/test/pummel/test-fs-watch-non-recursive.js
Rich Trott a030c5cf49 test: remove unused assert module imports
Many test modules load assert but do not use it. This change removes
those instances.

It also removes a handful of other unused variables when they were
nearby.

PR-URL: https://github.com/nodejs/node/pull/4438
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-30 11:45:34 -08:00

29 lines
760 B
JavaScript

'use strict';
var common = require('../common');
var path = require('path');
var fs = require('fs');
var testDir = common.tmpDir;
var testsubdir = path.join(testDir, 'testsubdir');
var filepath = path.join(testsubdir, 'watch.txt');
function cleanup() {
try { fs.unlinkSync(filepath); } catch (e) { }
try { fs.rmdirSync(testsubdir); } catch (e) { }
}
process.on('exit', cleanup);
cleanup();
try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {}
// Need a grace period, else the mkdirSync() above fires off an event.
setTimeout(function() {
var watcher = fs.watch(testDir, { persistent: true }, common.fail);
setTimeout(function() {
fs.writeFileSync(filepath, 'test');
}, 100);
setTimeout(function() {
watcher.close();
}, 500);
}, 50);