How to run a single test with Mocha?

前端 未结 12 1146
無奈伤痛
無奈伤痛 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:13

    Depending on your usage pattern, you might just like to use only. We use the TDD style; it looks like this:

    test.only('Date part of valid Partition Key', function (done) {
        //...
    }
    

    Only this test will run from all the files/suites.

提交回复
热议问题