Closed
Description
Environment
- OS Version: MacOS Monterrey 12.1
- Node.js Version: v16.13.0
- fast-glob: 3.2.7
Actual behavior
aus@Austins-MBP src % node index.js
[ 'foo/bar.txt', 'foo/ignore.txt' ]
[ 'foo/bar.txt', 'test/baz/.not_this_either.txt' ]
[ 'foo/bar.txt' ]
Results A: Works as expected. Gets all txt files, ignoring any in the test directory.
Results B: Does not work as expected. It does correctly give me all text files in the foo folder, except for the ignored ignore.txt
, but it also gives me one of (but notably not all) files in the test directory.
Results C: Works as expected, after making a slight change to the ignore option.
Expected behavior
aus@Austins-MBP src % node index.js
[ 'foo/bar.txt', 'foo/ignore.txt' ]
[ 'foo/bar.txt' ]
[ 'foo/bar.txt' ]
Steps to reproduce
- See code sample
Code sample
aus@Austins-MBP src % tree -a
.
├── foo
│ ├── bar.txt
│ └── ignore.txt
├── index.js
└── test
├── baz
│ ├── .not_this_either.txt
│ └── also_no.txt
└── no.txt
3 directories, 6 files
const fg = require('fast-glob');
const resultsA = fg.sync('**/*.txt', {
ignore: ['**/test/**/*']
});
console.log(resultsA);
const resultsB = fg.sync('**/!(ignore)*.txt', {
ignore: ['**/test/**/*']
});
console.log(resultsB);
const resultsC = fg.sync('**/!(ignore)*.txt', {
ignore: ['**/test/**']
});
console.log(resultsC);
Originally posted by @timtim17 in #329 (comment)