How to run a single test with Mocha?

前端 未结 12 1141
無奈伤痛
無奈伤痛 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 06:09

    Hi above solutions didn't work for me. The other way of running a single test is

    mocha test/cartcheckout/checkout.js -g 'Test Name Goes here'
    

    This helps to run a test case from a single file and with specific name.

提交回复
热议问题