How to Skip Some Tests in Mocha?

You can use the skip() method (on describe() or it()) to ignore some tests:

  • In case of describe, it will ignore all tests in the describe block (which includes all nested describe and it functions);
  • In case of it, it will ignore the individual test.

For example:

describe.skip('...', function () {
  // all tests in this block are skipped...
it.skip('...', function () {
  // this test is skipped...

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.