Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for extglob? #87

Open
rishabh-arya95 opened this issue Jul 12, 2023 · 3 comments
Open

Support for extglob? #87

rishabh-arya95 opened this issue Jul 12, 2023 · 3 comments
Assignees

Comments

@rishabh-arya95
Copy link

rishabh-arya95 commented Jul 12, 2023

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

@rishabh-arya95 rishabh-arya95 changed the title Pattern Match not working Support of extglob? Jul 12, 2023
@rishabh-arya95 rishabh-arya95 changed the title Support of extglob? Support for extglob? Jul 12, 2023
@bmatcuk
Copy link
Owner

bmatcuk commented Jul 12, 2023

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

@bmatcuk bmatcuk self-assigned this Jul 12, 2023
@rishabh-arya95
Copy link
Author

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

@bmatcuk
Copy link
Owner

bmatcuk commented Jul 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants