karma-runner - Karma 运行单一测试

标签 karma-runner

我使用 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/

相关文章:

javascript - 单元测试错误 "Fatal error: write after end"

testing - 无法使用 karma 运行端到端测试(对于 Angular )

linux - 如何让 Karma 与 Chrome 一起工作

angularjs - PhantomJS 1.9.8(Windows 7 0.0.0)错误引用错误: Can't find variable: angular

angular - 使用 Angular 4、Webpack 2、Karma 和 Jasmine 获得单元测试覆盖率

angularjs - 如何在指令中对隔离范围进行单元测试

javascript - Karma Jasmine AngularJs 定义未定义

javascript - 管理 Angular JS karma grunt 测试中的依赖关系

javascript - Karma runner 不会运行所有文件

javascript - AngularJS 单元测试 - 未定义不是函数