How to Run a Single Test With Mocha?

To run a single test (as defined in it()), you can simply call the only() method on it in the following way:

it.only('...', function () {
  // only this test will run...
});

Similarly, you can call only() on describe if you wish to run all the tests in a single describe() block.


Hope you found this post useful. It was published . Please show your love and support by sharing this post.