node.jsunit-testingmocha.jsbabeljsisparta

How Can I Define a Test Directory for Mocha?


I've written my tests using ES6 and executed them (with code coverage report) as follows:

$> babel-node isparta cover _mocha backend/tests

However, the tests are not found. It only works when I have a ./test directory.

Any suggestions on how I can define a different test directory?


Solution

  • You'd better try to use the following syntax:

    babel-node isparta cover _mocha -- './backend/tests/*' --recursive