Freewind Freewind - 4 months ago 29
Node.js Question

How to specify test directory for mocha?

Mocha tries to find test files under

test
by default, how do I specify another dir, e.g.
server-test
?

Answer

Here's one way, if you have subfolders in your test folder e.g.

/test
/test/server-test
/test/other-test

Then in linux you can use the find command to list all *.js files recursively and pass it to mocha:

mocha $(find test -name '*.js')
Comments