How to run a single test with Mocha?

前端 未结 12 1137
無奈伤痛
無奈伤痛 2020-12-04 05:46

I use Mocha to test my JavaScript stuff. My test file contains 5 tests. Is that possible to run a specific test (or set of tests) rather than all the tests in the file?

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 05:50

    npm test 
    

    eg :

    npm test test/api/controllers/test.js
    

    here 'test/api/controllers/test.js' is filepath.

提交回复
热议问题