Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tell Mocha where to look for test files

How can I tell Mocha where to look for my test files? My test files dont reside in the standard project root ./test folder. My test sit in Modules/.*/Tests/.

I've attempted to use the --grep command line argument but I have a feeling this argument looks for test NAMES not for test FILE NAMES.

mocha --grep Modules\/.*\/Tests

The above command gives the error:

Warning: Could not find any test files matching pattern: test
No test files found

like image 337
sazr Avatar asked Feb 20 '17 02:02

sazr


1 Answers

You have to match not only directory but also its files . Besides, do no need grep , use only -- :

mocha -- Modules/**/Tests/*.js
// or `mocha -- Modules/Tests/*.js` (I am not sure because you didn't give the project hierarchy )
like image 163
Abdennour TOUMI Avatar answered Sep 28 '22 00:09

Abdennour TOUMI