micromatch / glob-fs

file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
http://jonschlinkert.github.io/glob-fs
MIT License
55 stars 17 forks source link

Glob pattern is not filtering files as expected #22

Open etki opened 7 years ago

etki commented 7 years ago

Hi. I was expecting glob to recursively list all files and (internally) reject all that don't match provided pattern. However, given following actions taken:

git clone https://github.com/ama-team/voxengine-sdk.git
cd voxengine-sdk
git checkout f2a0af
npm i glob-fs -D # installed version: 0.1.7
cat <<EOF > index.js   
var glob = require('glob-fs')
glob().readdirPromise('test/**/*.spec.js')
  .then(console.log.bind(console));
EOF
node index.js

I have following output:

[
  '/tmp/voxengine-sdk/test/mocha.opts', // unexpected
  '/tmp/voxengine-sdk/test/spec/http/_common.spec.js',
  '/tmp/voxengine-sdk/test/spec/http/basic.spec.js',
  '/tmp/voxengine-sdk/test/spec/http/rest.spec.js',
  '/tmp/voxengine-sdk/test/spec/logger/_common.spec.js',
  '/tmp/voxengine-sdk/test/spec/logger/slf4j.spec.js',
  '/tmp/voxengine-sdk/test/support/mocha-multi-reporters.json', // unexpected
  '/tmp/voxengine-sdk/test/support/setup.js' // unexpected
]

Looks like it's either me misinterpreting how this package is designed to work (and all of the above is valid output) or a bug

jonschlinkert commented 7 years ago

Yeah, that's definitely a bug. This package is being refactored completely