test: refactor test-fs-watch-non-recursive

The test was duplicating some functionality in the `tmpdir` module.

PR-URL: https://github.com/nodejs/node/pull/25386
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott authored and Myles Borins committed 2019-05-16 14:56:27 -04:00
1 parent 82bc4ac226
commit 82dd321e91
1 file changed
+2 -8
+2 -8
View File
@@ -25,19 +25,13 @@ const path = require('path');
const fs = require('fs');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const testDir = tmpdir.path;
const testsubdir = path.join(testDir, 'testsubdir');
const filepath = path.join(testsubdir, 'watch.txt');
function cleanup() {
try { fs.unlinkSync(filepath); } catch { }
try { fs.rmdirSync(testsubdir); } catch { }
}
process.on('exit', cleanup);
cleanup();
try { fs.mkdirSync(testsubdir, 0o700); } catch {}
fs.mkdirSync(testsubdir, 0o700);
// Need a grace period, else the mkdirSync() above fires off an event.
setTimeout(function() {