Skip to content

Commit 7e61f5d

Browse files
committed
fix: make serial mode consistent with parallel
1 parent 3911700 commit 7e61f5d

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/repeater.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ module.exports = class TestRepeater {
3535
handleTestEnd(test) {
3636
this._repeatCounter.testExecuted(test);
3737

38-
if (!this._parallelRepeats && this._repeatCounter.getRepeatsLeft(test) > 0) {
38+
// In parallel mode, we always have 1 (initial run) + repeats test runs. We have + 1 here to account for that initial run
39+
if (!this._parallelRepeats && this._repeatCounter.getRepeatsLeft(test) + 1 > 0) {
3940
this._testplane.addTestToRun(test, test.browserId);
4041
}
4142
}

test/lib/repeater.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ describe('Repeater', () => {
9494

9595
it('should not add test to run when parallelRepeats is false and test has no repeats left', () => {
9696
const repeatCounter = _mkRepeatCounter();
97-
repeatCounter.getRepeatsLeft = sinon.stub().returns(0);
97+
// If repeats are set 0 and parallelRepeats is false, getRepeatsLeft would return -1 at runtime
98+
repeatCounter.getRepeatsLeft = sinon.stub().returns(-1);
9899
const repeater = Repeater.create(testplane, repeatCounter, false);
99100
const test = _mkTest();
100101

0 commit comments

Comments
 (0)