From b4a10b0d9c64004d0dd62b8c26b510f5142c6fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Tue, 30 Jul 2019 16:04:59 +0100 Subject: [PATCH] fixup! test: clean tmpdir on process exit --- test/pummel/test-fs-largefile.js | 6 ------ test/pummel/test-fs-watch-file-slow.js | 1 + test/pummel/test-fs-watch-file.js | 5 +---- test/pummel/test-regress-GH-814.js | 2 ++ test/pummel/test-regress-GH-814_2.js | 2 ++ 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/test/pummel/test-fs-largefile.js b/test/pummel/test-fs-largefile.js index 8200543b9a13e7..409d7a2112f027 100644 --- a/test/pummel/test-fs-largefile.js +++ b/test/pummel/test-fs-largefile.js @@ -47,9 +47,3 @@ assert.strictEqual(readBuf[0], 0); // Verify that floating point positions do not throw. fs.writeSync(fd, writeBuf, 0, writeBuf.length, 42.000001); fs.close(fd, common.mustCall()); - -// Normally, we don't clean up tmp files at the end of a test, but we'll make an -// exception for a 5 GB file. -process.on('exit', function() { - fs.unlinkSync(filepath); -}); diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index 94f2a263881427..c7513a18e6fa3e 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -27,6 +27,7 @@ const fs = require('fs'); const tmpdir = require('../common/tmpdir'); +tmpdir.refresh(); const FILENAME = path.join(tmpdir.path, 'watch-me'); const TIMEOUT = 1300; diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index 7a8854860c15f1..0d897bdc4adf94 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -46,10 +46,6 @@ const filenameThree = 'charm'; // Because the third time is const filenameFour = 'get'; process.on('exit', function() { - fs.unlinkSync(filepathOne); - fs.unlinkSync(filepathTwoAbs); - fs.unlinkSync(filenameThree); - fs.unlinkSync(filenameFour); assert.strictEqual(watchSeenOne, 1); assert.strictEqual(watchSeenTwo, 2); assert.strictEqual(watchSeenThree, 1); @@ -57,6 +53,7 @@ process.on('exit', function() { }); +tmpdir.refresh(); fs.writeFileSync(filepathOne, 'hello'); assert.throws( diff --git a/test/pummel/test-regress-GH-814.js b/test/pummel/test-regress-GH-814.js index d7af574e0ab87e..3ae6dd061c91df 100644 --- a/test/pummel/test-regress-GH-814.js +++ b/test/pummel/test-regress-GH-814.js @@ -37,6 +37,8 @@ function newBuffer(size, value) { } const fs = require('fs'); + +tmpdir.refresh(); const testFileName = require('path').join(tmpdir.path, 'GH-814_testFile.txt'); const testFileFD = fs.openSync(testFileName, 'w'); console.log(testFileName); diff --git a/test/pummel/test-regress-GH-814_2.js b/test/pummel/test-regress-GH-814_2.js index 1b40ca7b37cdfa..10de38a50c13fd 100644 --- a/test/pummel/test-regress-GH-814_2.js +++ b/test/pummel/test-regress-GH-814_2.js @@ -27,6 +27,8 @@ const assert = require('assert'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); + +tmpdir.refresh(); const testFileName = require('path').join(tmpdir.path, 'GH-814_test.txt'); const testFD = fs.openSync(testFileName, 'w'); console.error(`${testFileName}\n`);