micromatch: Negation glob causes issues with the newest version (3.0.1)

Negation glob causes issues with the newest version (3.0.1). The following still worked in version 2.3.11:

var micromatch = require('micromatch')
var fixtures = ["bar/bar"];
var result = micromatch(fixtures, ["foo/**", "!foo/baz"]);

I would expect result to be an empty array, but it is ["bar/bar"]. When I remove "!foo/baz" it works, so it seems to be connected.

Note: the same occurs if fixtures is a string (e.g. "bar/bar")

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Alright, this indeed works. Thank you for your quick fixing 😃

Behaviour is now different than multimatch. Just did a quick test:

behavior should have always been different than multimatch, because (IMHO) multimatch has always been wrong. If micromatch was producing the same value as multimatch before, I believe that was a bug that has now been fixed.

that said… hmm I’m wondering if there is indeed a bug with a single file when multiple patterns are passed and a negation pattern is given. I’m not sure why you keep using a single file in the examples, but maybe that’s what the bug is - if there is one. I’ll look into it.

Thanks for the explanation. I’ll take a look