Open sbellone opened 5 years ago
Both libraries should be aligned on this behaviour
Why?
Oh, I assumed that because in the description it states to be "Similar to micromatch", and because they have been aligned until last week (as micromatch was depending on it, I imagine).
Also it's a matter of having consistent behaviours inside the lib itself actually. If I take an example similar to the one from the linked discussion, I get this behaviour:
const nm = require('nanomatch');
console.log(nm(['t/'], ['t/']));
// [ 't/' ]
console.log(nm(['t/'], ['t']));
// []
Please describe the minimum necessary steps to reproduce this issue:
What is happening:
micromatch
takes into account the trailing slash and do an exact matchnanomatch
doesn't take it into account and match even without trailing slash in the patternWhat should be happening instead?
Both libraries should be aligned on this behaviour. From this previous issue on micromatch about trailing slashes, I believe we will want the fix to be done here in nanomatch.
Additional info
As
micromatch
switched fromnanomatch
topicomatch
in v4.x (during this refactor),micromatch
's behaviour has actually changed betweenv3.1.10
andv4.0.1
. It was previously behaving likenanomatch
. Again, after reading the discussion about the trailing slashes linked above, I believe we want to keep its new behaviour, so an additional unit test could be added in micromatch to be sure to stay consistent in the future.