Skip to content

Commit

Permalink
fixup! test: clean tmpdir on process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocgreis committed Jul 30, 2019
1 parent bd99911 commit b4a10b0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
6 changes: 0 additions & 6 deletions test/pummel/test-fs-largefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
1 change: 1 addition & 0 deletions test/pummel/test-fs-watch-file-slow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions test/pummel/test-fs-watch-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@ 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);
assert.strictEqual(watchSeenFour, 1);
});


tmpdir.refresh();
fs.writeFileSync(filepathOne, 'hello');

assert.throws(
Expand Down
2 changes: 2 additions & 0 deletions test/pummel/test-regress-GH-814.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions test/pummel/test-regress-GH-814_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down

0 comments on commit b4a10b0

Please sign in to comment.