Open Superskyyy opened 2 years ago
We've used this, and it worked great for us, although it's become out of date recently due to no node 12 support on GHA.
@Superskyyy I think that your expectation expect(rootMatch.backend).toEqual([])
is incorrect.
According to picomatch
documentation - the underlying matching library - a pattern like **/*.tsx
requires at least 1 path separator, so in your example root.tsx
doesn't match that part of the pattern and after negation actually matches the pattern.
If we try picomatch
directly:
const picomatch = require('picomatch');
const pattern = '!(**/*.tsx|**/*.less)';
console.log(picomatch.isMatch('root.tsx', pattern));
returns true
. If you want to ignore all *.tsx
files regardless of their location, you should replace **/*
with just **
in the pattern, see:
const picomatch = require('picomatch');
const pattern = '!(**.tsx|**/*.less)'; // new pattern
console.log(picomatch.isMatch('root.tsx', pattern));
returns false
.
For example below, I added a
rootFiles
and expect it to match nothing, however, it actually matches theroot.tsx
.