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

Inconsistent behavior around patterns that include /** #459

Closed
SuperchupuDev opened this issue Sep 27, 2024 · 1 comment
Closed

Inconsistent behavior around patterns that include /** #459

SuperchupuDev opened this issue Sep 27, 2024 · 1 comment

Comments

@SuperchupuDev
Copy link

Environment

  • OS Version: Windows 10 22H2
  • Node.js Version: 22.8.0

Actual behavior

fast-glob matches <pattern> with a <pattern>/** pattern only if <pattern> is a dynamic pattern (assuming you have onlyFiles: false in the options)

Expected behavior

It behaves the same way regardless of the pattern being dynamic or not

Steps to reproduce

  1. Create src/index.ts
  2. Do glob('src/**', { onlyFiles: false });. See how it returns ['src/index.ts']
  3. Now do glob('*rc/**', { onlyFiles: false });. It returns ['src', 'src/index.ts']

Code sample

import glob from 'fast-glob';

console.log(await glob('src/**', { onlyFiles: false }));

console.log(await glob('*rc/**', { onlyFiles: false }));
@mrmlnc
Copy link
Owner

mrmlnc commented Nov 23, 2024

This is because the fast-glob package still does not include the root directory in its output. In the second case, the root directory is considered ., so *rc matches the src directory.

This is a duplicate for #47.

@mrmlnc mrmlnc closed this as completed Nov 23, 2024
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

2 participants