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

makeRe-generated regexp for pattern 'some/path/**' matches 'some/path-but-different' #215

Open
abuob opened this issue Jul 1, 2023 · 2 comments

Comments

@abuob
Copy link

abuob commented Jul 1, 2023

Had a bit of a look through previous issues and from what I gathered some differences are to be expected, is this one of those cases?

Out of curiosity, I cloned the repository and crated a test as follows, which fails:

const { minimatch, makeRe } = require('../')
const t = require('tap')

t.test('is this intentional?', function (t) {
  const pattern = 'some/path/**'
  const input = 'some/path-but-different'

  const actualFromMinimatch = minimatch(input, pattern)      // returns false, as expected
  const actualFromMakeReTest = makeRe(pattern).test(input)   // returns true

  t.equal(actualFromMinimatch, false, 'input should not match the pattern')
  t.equal(actualFromMakeReTest, actualFromMinimatch, 'this should be equal?')

  t.end()
})

Note that it does not seem to rely on path-but-different, any path that begins with some/path seems to have this issue; is this intentional?

@isaacs
Copy link
Owner

isaacs commented Jul 1, 2023

Hm. I'd call that a bug, definitely not intentional, and likely a regression with the somewhat recently rewritten parsing logic. Thanks for the clear report and repro test. Should be able to get it fixed soon.

@alicenstar
Copy link

alicenstar commented Oct 2, 2023

@isaacs Just wanted to jump on and say that I've also run into this bug. Is there any recommended workaround that we could use in the meantime? This is a pretty impactful bug for me. Means ** doesn't work in 100% of cases.

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