Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When watching multiple patterns (e.g. ["**/*.ts", "**/*.tsx"]), some files from linked dirs are skipped #987

Closed
cristian-spiescu opened this issue Mar 8, 2020 · 0 comments

Comments

@cristian-spiescu
Copy link

Describe the bug

I have the following dir structure:

link // a linked dir
  file.ts
  file.tsx
non-link
  file.ts
  file.tsx

Watching "." works. I.e it finds all the 4 files above. But watching [ "**/*.ts*", "**/t.tsx"] doesn't find link/file.tsx. I.e. it finds only 3 files.

NOTE: The above input for chokidar is generated by mocha.

Versions (please complete the following information):

  • Chokidar version: 3.3.0
  • Node version: 12.14.1
  • OS version: Windows 10

To Reproduce:

Using the 2 dirs and 4 files cf. above:

const chokidar = require("chokidar");
const watcher = chokidar.watch([ '**/*.ts', '**/*.tsx'])
watcher.on("ready", () => {
    console.log(watcher.getWatched())
})

outputs:

{
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib': [ 'link', 'non-link' ],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\**\\*.ts': [],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\**\\*.tsx': [],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\non-link': [ 'file.ts', 'file.tsx' ],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\link': [ 'file.ts' ]
}

We can see that link/file.tsx is missing. So we have 3 of 4 files present.

If using: const watcher = chokidar.watch("."), all 4 files are present:

{
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib': [
    'constants.js',
    'fsevents-handler.js',
    'link',
    'nodefs-handler.js',
    'non-link',
    'test.js'
  ],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\non-link': [ 'file.ts', 'file.tsx' ],
  'E:\\data\\git-repos\\leave-management\\leave-management-react\\node_modules\\mocha\\node_modules\\chokidar\\lib\\link': [ 'file.ts', 'file.tsx' ]
}
@cristian-spiescu cristian-spiescu changed the title When watching multiple patterns (e.g. **/*.ts AND **/*.tsx), some files from linked dirs are skipped When watching multiple patterns (e.g. ["**/*.ts", "**/*.tsx"]), some files from linked dirs are skipped Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants