summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-01-07 21:57:40 -0800
committerRich Trott <rtrott@gmail.com>2019-01-09 22:19:23 -0800
commitfa5af0d50846083fcd0bb9de6006bb57424a17cf (patch)
treed4f660873a9ec39bf1695bf38a1ac1180435b045 /test
parent82f03f89b4ceda21e4e1e758c28ef3283ff2d5f0 (diff)
downloadandroid-node-v8-fa5af0d50846083fcd0bb9de6006bb57424a17cf.tar.gz
android-node-v8-fa5af0d50846083fcd0bb9de6006bb57424a17cf.tar.bz2
android-node-v8-fa5af0d50846083fcd0bb9de6006bb57424a17cf.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/pummel/test-fs-watch-non-recursive.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/test/pummel/test-fs-watch-non-recursive.js b/test/pummel/test-fs-watch-non-recursive.js
index c459acb14e..b9a6cd6dcf 100644
--- a/test/pummel/test-fs-watch-non-recursive.js
+++ b/test/pummel/test-fs-watch-non-recursive.js
@@ -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() {