How do I run a single test using Jest?

后端 未结 14 1883
轮回少年
轮回少年 2020-12-12 10:22

I have a test \'works with nested children\' within the file fix-order-test.js.

Running the below runs all the tests in the file.

jest fix-order-test         


        
14条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 10:34

    You can also use f or x to focus or exclude a test. For example

    fit('only this test will run', () => {
       expect(true).toBe(false);
    });
    
    it('this test will not run', () => {
       expect(true).toBe(false);
    });
    
    xit('this test will be ignored', () => {
       expect(true).toBe(false);
    });
    

提交回复
热议问题