Jasmine 2.0中的测试用例是否并行运行 [英] Are test cases in Jasmine 2.0 run in parallel
问题描述
Jasmine 2.0中的测试是否并行运行?根据我的经验,他们不是这篇文章,由 Jasmine.js:Race引用使用运行时的条件表明Jasmine确实并行运行它们,所以我想知道我是否错误地编写了测试。
Are tests in Jasmine 2.0 run in parallel? In my experience they aren't but the article , referenced by Jasmine.js: Race Conditions when using "runs" suggests that Jasmine does run them in parallel so I wondered if I was writing my tests incorrectly.
这是一组测试我希望在1秒而不是4秒内执行。
Here is a set of tests that I would expect to execute in 1 second instead of 4 seconds.
describe("first suite", function() {
it("first test", function(done) {
expect(true).toBeTruthy();
setTimeout(done, 1000);
});
it("second test", function(done) {
expect(true).toBeTruthy();
setTimeout(done, 1000);
});
});
describe("second suite", function() {
it("first test", function(done) {
expect(true).toBeTruthy();
setTimeout(done, 1000);
});
it("second test", function(done) {
expect(true).toBeTruthy();
setTimeout(done, 1000);
});
});
我错过了什么吗?
< a href =http://jsfiddle.net/dspigarelliMNDNT/2bo511uo/ =noreferrer> jsFiddle
推荐答案
Jasmine实际上并没有以任何方式并行运行您的规范。但是,如果规范的异步部分需要足够长的时间,内置的时间限制将会导致茉莉花开始运行下一个规范,即使可能仍然存在从早期规范运行的代码。
Jasmine does not actually run your specs in parallel in any way. It is however possible to have specs whose asynchronous portion takes long enough that the built-in time limit elapses which will cause jasmine to start running the next spec, even though there may still be code running from earlier specs.
这篇关于Jasmine 2.0中的测试用例是否并行运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!