How to specify test directory for mocha?

后端 未结 14 1680
走了就别回头了
走了就别回头了 2020-12-04 05:59

Mocha tries to find test files under test by default, how do I specify another dir, e.g. server-test?

14条回答
  •  天涯浪人
    2020-12-04 06:29

    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')
    

提交回复
热议问题