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

Folder rename is not reported when using a pattern

Janpot opened this issue · comments

Describe the bug

When a folder is renamed and the original and new folder is part of a path that is covered by a glob that chokidar is watching, no events are fired.

Versions:

  • Chokidar version: 3.5.3
  • Node version: 18.16.0
  • OS version: MacOs 13.5

To Reproduce:

  1. create a file ./hello/foo/file.txt
  2. run
    const path = require('path');
    const chokidar = require('chokidar');
    
    chokidar.watch(path.resolve(__dirname, './hello/*/file.txt')).on('all', (event, filePath) => {
      console.log(event, filePath);
    });
  3. run mv ./hello/foo ./hello/bar
  4. no events are being fired

Expected behavior

an unlink and add event is fired for the rename. (This does happen when using usePolling)

I also reproduced this problem with @Janpot 's example but a little bit differently, I could get add event when moving a dir, but no unlink event.