Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glob for all folders within a folder except one named folder

I am writing my Karma conf based on

http://karma-runner.github.io/1.0/config/preprocessors.html

The key for the preprocessor is a glob string.

This works for all folders within the build folder:

build/**/!(*.spec|*.bundle|*.min).js

However, I don't want all folders. I wanted folder 1,2,4,5 NOT folder 3

Can I write that in a single string (as seems to be required by karma)?

Something like

build/(folder1|folder2|folder4|folder5)/!(*.spec|*.bundle|*.min).js

or even better

build/** but not folder 3/!(*.spec|*.bundle|*.min).js
like image 679
danday74 Avatar asked Sep 02 '16 15:09

danday74


1 Answers

This covers it

https://github.com/karma-runner/karma-coverage/issues/13

Quoting it

You can make this work using brace expansion. For @chevalric's case, the following pattern will do it:

src/*/{*.js,!(test)/**/*.js}

This expands to two patterns:

src/*/*.js              # Match files in the module root
src/*/!(test)/**/*.js   # Match files in all subfolders except test/

Also it later says ..

src/*/!(test)/**/*.js

worked

However, for me, I could not test that this worked for various reasons.

like image 186
danday74 Avatar answered Nov 11 '22 07:11

danday74