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:
parent
82f03f89b4
commit
fa5af0d508
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user