I saw this pattern used in a configuration file for protractor.
specs: [
'test/e2e/**/*.spec.js'
]
To mean it means "all files inside test/e2e". What kind of pattern is this? I think it's not regex because of those unescaped slashes. Especially, why is there **
in the middle, not just test/e2e/*.spec.js
?
I tried using the search engine, but did not find anything useful probably because the asterisks don't work very well in search engines.
What kind of pattern is this?
It is called "glob". The module glob is a popular implementation for Node, and appears to be the one used by Protractor.
Especially, why is there "**" in the middle, not just "test/e2e/*.spec.js"?
**
means it can match sub-directories. It's like a wildcard for sub-directories.
For example, test/e2e/*.spec.js
would match test/e2e/example.spec.js
, but not test/e2e/subdir/example.spec.js
. However test/e2e/**/*.spec.js
matches both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With