Skip to content

Ignored directories not being ignored #773

Closed
@mlynch

Description

@mlynch

Describe the bug
Ignored does not ignore all files in all subdirectories of the ignored paths. For example, **/node_modules/**/* does not ignore files in **/node_modules/.staging/**/*

This can be checked by watching a typical JS project that uses npm, and then running npm install in that directory. You will receive file added events for files in node_modules/.staging which is incorrect.

I tried a lot of permutations of the ignored paths, such as **/node_modules which did not work either.

Versions (please complete the following information):

  • Chokidar version [e.g. 2.0.4, or commit hash] 2.0.4
  • Node version [e.g. 10.4.1] 8.11.1
  • OS version: [e.g. Ubuntu 16.04, or Windows 10] OS X 10.13.3

To Reproduce
Steps to reproduce the behavior.

var chokidar = require('chokidar');
var fs = require('fs');
// One-liner for files and directories starting with 'test'
const watcher = chokidar.watch(path, {
  ignored:  ['**/node_modules/**/*', '**/.git/**/*'],
  ignoreInitial: true,
  ignorePermissionErrors: true,
  followSymlinks: true,
  interval: 1000,
  binaryInterval: 1000,
});

Expected behavior
All files in any node_modules directory and any subdirectory in any node_modules directory will be ignored.

Additional context
I was able to work around the issue by using the function form of ignored to simply reject any path that has node_modules in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions