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

Glob with Trailing / Matches Files as well as Folders #45

Open
kahagerman opened this issue Sep 25, 2024 · 5 comments
Open

Glob with Trailing / Matches Files as well as Folders #45

kahagerman opened this issue Sep 25, 2024 · 5 comments

Comments

@kahagerman
Copy link

For example, packages/*/ will match a file at packages/foo.

I think expected behaviour here is to only match folders (packages/bar/).

See related downstream discussion on vitest.

@SuperchupuDev
Copy link
Owner

interesting, does fast-glob present that behavior? can you provide a minimal repro?

@SuperchupuDev SuperchupuDev added the bug Something isn't working label Sep 25, 2024
@SuperchupuDev
Copy link
Owner

I see the issue now, fast-glob (which this package aims to replace) does act that way

@SuperchupuDev
Copy link
Owner

SuperchupuDev commented Sep 25, 2024

@kahagerman further investigating i've noticed that fast-glob (which is what vitest used before and this package aims to be a replacement of) has really inconsistent behavior around trailing / in patterns and the behavior you describe is only present if the pattern is dynamic (otherwise fast-glob matches files too!). because of this, i'm not sure if making tinyglobby inconsistent as well would be a good idea

you can test this inconsistency in fast-glob this way:

import glob from 'fast-glob';

// dynamic pattern, only returns folders so no files are matched
await glob(['*.ts/'], {
  onlyFiles: false
});

// static pattern, returns files too
await glob(['index.ts/'], {
  onlyFiles: false
});

@SuperchupuDev SuperchupuDev removed the bug Something isn't working label Sep 25, 2024
@benmccann
Copy link
Contributor

Hmm. Maybe the thing to do is report it as a bug in fast-glob. If they fix it then we can remain consistent with fast-glob

@SuperchupuDev
Copy link
Owner

SuperchupuDev commented Sep 29, 2024

reported it some days ago at mrmlnc/fast-glob#458. will probably do whatever fast-glob does as long as it's applied in a consistent way

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

No branches or pull requests

3 participants