Open jakobrosenberg opened 3 years ago
Fixed with by changing glob to **/*.internal-test.js
I noticed this inconsistency. Not sure if this is by design or a bug. To err on the side of caution, I'll reopen the issue.
import picomatch from "picomatch";
const isMatch1 = picomatch('**/*.dash-thing.js')
const isMatch2 = picomatch('**/*.thing.js')
const isMatch3 = picomatch('**.dash-thing.js')
const isMatch4 = picomatch('**.thing.js')
console.log(isMatch1('somepath/test.dash-thing.js')) // true
console.log(isMatch2('somepath/test.thing.js')) // true
console.log(isMatch3('somepath/test.dash-thing.js')) // false
console.log(isMatch4('somepath/test.thing.js')) // true
Good catch. '**.thing.js'
should not match, so that is a bug since **
should be treated as a single star when it's not the only thing in a path segment (according to bash).
However, the correct way to do what you want is one of the following:
const isMatch1 = picomatch('*/*.thing.js')
const isMatch2 = picomatch('**/*.thing.js')
console.log(isMatch1('somepath/test.thing.js')) // true
console.log(isMatch2('somepath/test.thing.js')) // true
thanks for the issue!
I would expect the below to be true
However this works