You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Watching ./foo/bar.txt when ./foo/ does not yet exists won't trigger any event when ./foo/bar.txt is finally created.
Having ./foo/ existing when calling chokidar.watch or watching ./*/bar.txt works correctly, though.
Versions (please complete the following information):
Chokidar version: 3.0.2
Node version: v12.6.0
OS version: Ubuntu 18.04.2 LTS
To Reproduce
constchokidar=require('chokidar');constfs=require('fs');// Make sure no ./foo directory currently existschokidar.watch('foo/test*',{}).on('all',()=>{console.log('This will never be called');});chokidar.watch('*/test*',{}).on('all',()=>{console.log('This will be called');});fs.mkdirSync('foo');fs.writeFileSync('foo/test.txt','testing 1');// Both events should fire, but only the second watcher is triggered
From reading the tests it seems to be expected behavior (the tests explicitly create directories before watching files), but I can't find any documentation on the subject nor any way to bypass it.
Expected behavior
I would expect events to be fired when files are created inside of non-yet-existing directories, no matter how I define my pattern (with a glob, or a static string).
Additional context
I'm currently using a hack to force chokidar to treat my static string as a glob by using (foo|$*)/test* instead of foo/test*. $* will never match anything so both foo and (foo|$*) should match the same things, but it seems to somehow trigger chokidar into the right behavior.
The text was updated successfully, but these errors were encountered:
Describe the bug
Watching
./foo/bar.txt
when./foo/
does not yet exists won't trigger any event when./foo/bar.txt
is finally created.Having
./foo/
existing when callingchokidar.watch
or watching./*/bar.txt
works correctly, though.Versions (please complete the following information):
To Reproduce
From reading the tests it seems to be expected behavior (the tests explicitly create directories before watching files), but I can't find any documentation on the subject nor any way to bypass it.
Expected behavior
I would expect events to be fired when files are created inside of non-yet-existing directories, no matter how I define my pattern (with a glob, or a static string).
Additional context
I'm currently using a hack to force chokidar to treat my static string as a glob by using
(foo|$*)/test*
instead offoo/test*
.$*
will never match anything so bothfoo
and(foo|$*)
should match the same things, but it seems to somehow trigger chokidar into the right behavior.The text was updated successfully, but these errors were encountered: