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

Question mark is not recognized as dynamic glob and fails to find files #174

Closed
vladshcherbin opened this issue May 8, 2019 · 0 comments · Fixed by #175
Closed

Question mark is not recognized as dynamic glob and fails to find files #174

vladshcherbin opened this issue May 8, 2019 · 0 comments · Fixed by #175
Assignees
Milestone

Comments

@vladshcherbin
Copy link
Contributor

Environment

  • OS Version: mac os 10.13.4
  • Node.js Version: 11.14.0
  • Fast-glob Version: 2.2.6

Actual behavior

I have a file: assets/css.css and a pattern with question mark: assets/?ss.css.

The file doesn't match the pattern.

Expected behavior

Since ? is for a single character, I'd expect the file to match the pattern.

I tried same thing with glob and micromatch, both of them return a match.

After a small investigation I found that assets/?ss.css pattern is considered as static here. is-glob package is used there and returns false for this pattern.

Steps to reproduce

Here is a repo with reproduction.

Use yarn start/npm start or run index.js file.

Code sample

const fastGlob = require('fast-glob')
const glob = require('glob')
const micromatch = require('micromatch')
const isGlob = require('is-glob')

async function run() {
  const pattern = 'assets/?ss.css'

  // fast glob
  console.log('fast-glob', await fastGlob(pattern)) // []

  // glob
  console.log('glob', glob.sync(pattern)) // [ 'assets/css.css' ]

  // micromatch
  console.log('micromatch', micromatch('assets/css.css', pattern)) // [ 'assets/css.css' ]

  // is glob
  console.log('is-glob', isGlob(pattern)) // false
}

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

Successfully merging a pull request may close this issue.

2 participants