我使用 karma 来运行测试。我有很多测试,运行所有测试是一个非常缓慢的过程。我只想运行一个测试,以便花费更少的时间,因为所有测试都运行大约 10 分钟。
可能吗?
最佳答案
如果您使用Karma/Jasmine堆栈,请使用:
fdescribe("when ...", function () { // to [f]ocus on a single group of tests
fit("should ...", function () {...}); // to [f]ocus on a single test case
});
...和:
xdescribe("when ...", function () { // to e[x]clude a group of tests
xit("should ...", function () {...}); // to e[x]clude a test case
});
当您使用Karma/Mocha时:
describe.only("when ...", function () { // to run [only] this group of tests
it.only("should ...", function () {...}); // to run [only] this test case
});
...和:
describe.skip("when ...", function () { // to [skip] running this group of tests
it.skip("should ...", function () {...}); // to [skip] running this test case
});
关于karma-runner - Karma 运行单一测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26552729/