Jake M Jake M - 2 years ago 151
Node.js Question

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

Answer Source

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 )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download