Karma run single test

后端 未结 9 1313
后悔当初
后悔当初 2020-11-28 11:33

I use karma for run tests. I have many tests and run all tests is very slow process. I want to run only single test in order to spend less time, because all test runs about

9条回答
  •  误落风尘
    2020-11-28 12:27

    If you are using the Karma/Jasmine stack, use:

    fdescribe("when ...", function () { // to [f]ocus on a single group of tests
      fit("should ...", function () {...}); // to [f]ocus on a single test case
    });
    

    ... and:

    xdescribe("when ...", function () { // to e[x]clude a group of tests
      xit("should ...", function () {...}); // to e[x]clude a test case
    });
    

    When you're on Karma/Mocha:

    describe.only("when ...", function () { // to run [only] this group of tests
      it.only("should ...", function () {...}); // to run [only] this test case
    });
    

    ... and:

    describe.skip("when ...", function () { // to [skip] running this group of tests
      it.skip("should ...", function () {...}); // to [skip] running this test case
    });
    

提交回复
热议问题