How this model works: 'test / e2e / ** / *. Spec.js'?

I saw this template used in the protractor configuration file .

specs: [
  'test/e2e/**/*.spec.js'
]

This means "all files inside test / e2e." What is this sample? I think this is not a regular expression because of these slashes. Especially why **in the middle, and not just test/e2e/*.spec.js?

I tried to use a search engine, but did not find anything useful, probably because asterisks do not work very well in search engines.

+4
source share
3 answers

What picture is this?

" glob". glob Node , -, , Protractor.

, "**" , "test/e2e/*. spec.js"?

** , . .

, test/e2e/*.spec.js test/e2e/example.spec.js, test/e2e/subdir/example.spec.js. test/e2e/**/*.spec.js .

+6

glob. Glob - , .

  • *.js " js.
  • ** "/ .
  • **/*.js "- js ".
  • test/e2e/**/*.spec.js' , test/e2e/.

, , :

test/e2e/foo/a.spec.js <-- matches
test/e2e/foo/butter.js <-- does not include "spec.js"
test/e2e/bar/something.spec.js <-- matches
test/other/something-different.spec.js <-- not in /test/e2e

:

test/e2e/foo/a.spec.js
test/e2e/bar/something.spec.js
+4

. javascript , -, glob npm. , , .

, , , .spec.js any test/e2e

+2

Source: https://habr.com/ru/post/1622385/


All Articles