From 5ab0410d1343648df21bdb8f59c1e9bae9e9a7b8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 7 Jan 2019 21:57:40 -0800 Subject: [PATCH] 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 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- test/pummel/test-fs-watch-non-recursive.js | 10 ++-------- 1 file 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 c459acb14ec483..b9a6cd6dcfb1d0 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() {