sindresorhus / globby

User-friendly glob matching
MIT License
2.49k stars 126 forks source link

Negation in globbySync seems to miss files #237

Open k2snowman69 opened 1 year ago

k2snowman69 commented 1 year ago

I can't seem to get globbySync to perform a proper negation glob. I'm fairly sure this is likely user error but I honestly can't wrap my head around it.

I created a repo with an app folder to run globby sync on - https://github.com/k2snowman69/issue-sortier-1763/tree/main/app Then I created some tests to show a variety of tests - https://github.com/k2snowman69/issue-sortier-1763/blob/main/app/globby.test.js

Currently none of the negation tests succeed.

A good example of my confusion is the test "Negation first › pulls non-css or non-js files - curly" which runs const files = globbySync(`!**/*.{json,css}`);. This should match 3 files but unexpectedly I get 0 matches.

Further if I take this exact example to an online glob tester this same glob !**/*.{json,css} does seem to actually result in matching everything except for json or css files.

Do note that some of those negate unit tests are meant to fail... I was mostly just trying stuff to see if anything worked.

So any help here to understand why globbySync wouldn't return the correct negation result would be helpful, thanks!

In case it matters: