Skip to content

Commit 837ca76

Browse files
Trottaddaleax
authored andcommittedJan 14, 2019
test: refactor test-fs-watch-non-recursive
The test was duplicating some functionality in the `tmpdir` module. PR-URL: #25386 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 65dfeeb commit 837ca76

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎test/pummel/test-fs-watch-non-recursive.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,13 @@ const path = require('path');
2525
const fs = require('fs');
2626

2727
const tmpdir = require('../common/tmpdir');
28+
tmpdir.refresh();
2829

2930
const testDir = tmpdir.path;
3031
const testsubdir = path.join(testDir, 'testsubdir');
3132
const filepath = path.join(testsubdir, 'watch.txt');
3233

33-
function cleanup() {
34-
try { fs.unlinkSync(filepath); } catch { }
35-
try { fs.rmdirSync(testsubdir); } catch { }
36-
}
37-
process.on('exit', cleanup);
38-
cleanup();
39-
40-
try { fs.mkdirSync(testsubdir, 0o700); } catch {}
34+
fs.mkdirSync(testsubdir, 0o700);
4135

4236
// Need a grace period, else the mkdirSync() above fires off an event.
4337
setTimeout(function() {

0 commit comments

Comments
 (0)
Please sign in to comment.