Here's a very simple set of test cases. Based on my understanding of negation, !(<some pattern>) should precisely invert the results of (<some pattern>), i.e. any path that matches the first should not match the second, and vice versa. This is not the case.
const pm = require('picomatch');
function test(matcher, path) {
const matches = matcher(path) ? '✓' : '✗';
console.log(`${matches}: ${path}`);
}
const tests = ['foo', 'foo/.bar', '.bar', '.foo/.bar'];
function testGlob(glob) {
const matcher = pm(glob);
console.log(glob)
tests.forEach(t => test(matcher, t));
console.log('')
}
testGlob('.*')
testGlob('(.*)')
testGlob('!(.*)')
Current output:
.*
✗: foo
✗: foo/.bar
✓: .bar
✗: .foo/.bar
(.*)
✗: foo
✗: foo/.bar
✓: .bar
✗: .foo/.bar
!(.*)
✓: foo
✗: foo/.bar
✗: .bar
✗: .foo/.bar
The first two patterns match correctly, but ! appears to break the behavior of .*
Here's a very simple set of test cases. Based on my understanding of negation,
!(<some pattern>)should precisely invert the results of(<some pattern>), i.e. any path that matches the first should not match the second, and vice versa. This is not the case.Current output:
The first two patterns match correctly, but
!appears to break the behavior of.*