Skip to content

Commit

Permalink
test: refreshTmpDir for test-fs-watchfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed May 27, 2017
1 parent 2db6556 commit 35ae48c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/parallel/test-fs-watchfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ fs.watchFile(enoentFile, {interval: 0}, common.mustCall(function(curr, prev) {
}
}, 2));

common.refreshTmpDir();

This comment has been minimized.

Copy link
@Trott

Trott May 30, 2017

Member

Because there is a call to refreshTmpDir() on line 39, and the fs.watchfile() in between is asynchronous, this basically gets called immediately after the previous refreshTmpDir() and should have no effect.

This comment has been minimized.

Copy link
@refack

refack May 30, 2017

Author Contributor

Cool. Closing.


// Watch events should callback with a filename on supported systems
if (common.isLinux || common.isOSX || common.isWindows || common.isAix) {
const dir = common.tmpDir + '/watch';
const file = `${dir}/foo.txt`;

fs.mkdir(dir, common.mustCall(function(err) {
if (err) assert.fail(err);
Expand All @@ -76,7 +79,7 @@ if (common.isLinux || common.isOSX || common.isWindows || common.isAix) {
assert.strictEqual(filename, 'foo.txt');
}));

fs.writeFile(`${dir}/foo.txt`, 'foo', common.mustCall(function(err) {
fs.writeFile(file, 'foo', common.mustCall(function(err) {
if (err) assert.fail(err);
}));
}));
Expand Down

0 comments on commit 35ae48c

Please sign in to comment.