How to programmatically skip a test in mocha?

前端 未结 14 1167
失恋的感觉
失恋的感觉 2020-12-07 17:31

I have a code where certain tests will always fail in CI environment. I would like to disable them based on an environment condition.

How to programmatically skip a

14条回答
  •  醉话见心
    2020-12-07 17:45

    to skip tests, use describe.skip or it.skip

    describe('Array', function() {
      it.skip('#indexOf', function() {
        // ...
      });
    });
    

    to include tests you could use describe.only or it.only

    
    describe('Array', function() {
      it.only('#indexOf', function() {
        // ...
      });
    });
    

    More info at https://mochajs.org/#inclusive-tests

提交回复
热议问题