paulmillr / chokidar

Minimal and efficient cross-platform file watching library

Home Page:https://paulmillr.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The watcher does not recognize file changes when the watched directory (or its parent) is deleted once

EhabY opened this issue · comments

This is the exact same issue as in #1042 except it happens when deleting the watched folder exactly and not a sub-directory.

Versions:

  • Chokidar version: 3.5.3
  • Node version: 16.17.0
  • OS version: Windows 10

To Reproduce:

  1. Watch a folder (test)
const watcher = chokidar.watch("test");
watcher.on("all", (a, b) => console.log(a, b));
  1. Delete test folder
  2. Create test folder again
  3. Add a file inside of it (file.txt)
  4. Modify file.txt

Output

addDir test
unlinkDir test

Expected Output

addDir test
unlinkDir test
addDir test
add file.txt
change file.txt

The issue also happens if you delete any of the watched directories parents...

Additional context
Another issue happens when watching a single file: if you delete the file and then add it, events "change" and "add" are both triggered when it should only be "add".