bmatcuk / doublestar

Implements support for double star (**) matches in golang's path.Match and filepath.Glob.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for extglob?

rishabh-arya95 opened this issue · comments

I was writing a utility to detect test files for various javascript test frameworks. Was trying to use the glob pattern mentioned here
https://playwright.dev/docs/api/class-testconfig#test-config-test-match, but it seems the pattern **/*.@(spec|test).?(c|m)[jt]s?(x) is not matching the file paths like login-screen.wrong-credentials.spec.ts

doublestar.Match(`**/*.@(spec|test).?(c|m)[jt]s?(x)`,  "test/login-screen.wrong-credentials.test.ts") // returns false

I have also tried testing in this online tool, here the result passes

doublestar does not support this syntax... but this might work: **/*.{spec,test}.{c,m,}[jt]s{x,}

Yes, this does certainly work, I see you have marked it as an enhancement. It will be great if extended globbing support is also added, sharing this popular library https://github.com/micromatch/extglob which has implemented this for js

It's not likely something I'd get in to doublestar any time soon, unfortunately... and it's a bit out-of-scope for what the library is trying to accomplish (which is just to implement **). But I keep a list of feature requests and if I ever find the time, I'll see what I can do.