Skip one test in test file Jest

后端 未结 3 727
盖世英雄少女心
盖世英雄少女心 2021-02-04 23:21

I\'m using Jest framework and have a test suite. I want to turn off/skip one of my tests.

Googling documentation doesn\'t give me answers.

Do you know the answ

3条回答
  •  半阙折子戏
    2021-02-04 23:38

    You can also exclude test or describe by prefixing them with an x.

    Individual Tests

    describe('All Test in this describe will be run', () => {
      xtest('Except this test- This test will not be run', () => {
       expect(true).toBe(true);
      });
      test('This test will be run', () => {
       expect(true).toBe(true);
      });
    });
    

    Multiple tests inside a describe

    xdescribe('All tests in this describe will be skipped', () => {
     test('This test will be skipped', () => {
       expect(true).toBe(true);
     });
    
     test('This test will be skipped', () => {
       expect(true).toBe(true);
     });
    });
    

提交回复
热议问题