Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-02-25 04:54:04 +0400
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-02-25 04:54:04 +0400
commit3a3b7488b58031ec8c9cd5faa28333eb93842d4f (patch)
tree5bc47ce7c08fefc10b9346aff11d53f9e6227036 /test
parente324717f8daca4f6d09ea18263f0b6e55caf37fa (diff)
test: pummel fs-watch-file-slow handle spurious
watch file will now generate an empty event when the file doesn't exist initially
Diffstat (limited to 'test')
-rw-r--r--test/pummel/test-fs-watch-file-slow.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js
index 4124e0b2722..2e4bc100168 100644
--- a/test/pummel/test-fs-watch-file-slow.js
+++ b/test/pummel/test-fs-watch-file-slow.js
@@ -40,10 +40,13 @@ fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) {
console.log([curr, prev]);
switch (++nevents) {
case 1:
+ assert.equal(fs.existsSync(FILENAME), false);
+ break;
case 2:
+ case 3:
assert.equal(fs.existsSync(FILENAME), true);
break;
- case 3:
+ case 4:
assert.equal(fs.existsSync(FILENAME), false);
fs.unwatchFile(FILENAME);
break;
@@ -53,21 +56,24 @@ fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) {
});
process.on('exit', function() {
- assert.equal(nevents, 3);
+ assert.equal(nevents, 4);
});
setTimeout(createFile, TIMEOUT);
function createFile() {
+ console.log('creating file');
fs.writeFileSync(FILENAME, "test");
setTimeout(touchFile, TIMEOUT);
}
function touchFile() {
+ console.log('touch file');
fs.writeFileSync(FILENAME, "test");
setTimeout(removeFile, TIMEOUT);
}
function removeFile() {
+ console.log('remove file');
fs.unlinkSync(FILENAME);
}