我知道我可以使用mocha.parallel
并行执行我的it()
测试,但是如何在执行每个describe()
测试时并行执行每个it()
块describe()
阻止顺序?
例如,假设我有一系列测试将文件从A点复制到B,然后从B复制到C,然后从C复制到D,这样每个测试都依赖于最后一个并且必须按顺序执行:
describe('file transfer test', function () {
it('copies file from A to B', function (done) {...});
it('copies file from B to C', function (done) {...});
it('copies file from C to D', function (done) {...});
});
现在假设我想要执行此测试套件3次并行3个不同大小的不同文件:
// in parallel
describe('file transfer test 1', function () {
it('copies file 1 from A to B', function (done) {...});
it('copies file 1 from B to C', function (done) {...});
it('copies file 1 from C to D', function (done) {...});
});
describe('file transfer test 2', function () {
it('copies file 2 from A to B', function (done) {...});
it('copies file 2 from B to C', function (done) {...});
it('copies file 2 from C to D', function (done) {...});
});
describe('file transfer test 3', function () {
it('copies file 3 from A to B', function (done) {...});
it('copies file 3 from B to C', function (done) {...});
it('copies file 3 from C to D', function (done) {...});
});
我怎样才能做到这一点?