I am looking for a glob that matches all descendant directories except those of a specific name. For instance foo/**/*.js matches all *.js files that are descendents of foo/, which is good; the extension of that pattern that I want ignores any descendants that are under a __tests__ directory.
foo/
file01.js
__tests__/
ignore01.js
bar/
file02.js
__tests__/
ignore02.js
qux
ignore04.js
baz/
file03.js
__tests__/
ignore03.js
What I have tried:
foo/**!(__tests__)/*.jsfoo/!(__tests__)**/*.jsfoo/**!(__tests__)**/*.jsfoo/**/!(__tests__)/*.jsfoo/!(__tests__)/**/*.js
Not the most elegant solution, but using an expansion should work here:
This expands to two conditions which should match your paths, namely
You can read more about globs over here.