Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/e2e/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ const runTests = async () => {

// We run each test multiple time to average out the results
const testLog = Logger.progressInfo('');
// For each test case we allow the test to fail three times before we stop the test run:
const errorCountRef = {
errorCount: 0,
allowedExceptions: 3,
};
for (let i = 0; i < config.RUNS; i++) {
progressText = `Suite '${suite.name}' [${suiteIndex + 1}/${suites.length}], iteration [${i + 1}/${config.RUNS}]\n`;
testLog.updateText(progressText);
Expand All @@ -341,9 +346,11 @@ const runTests = async () => {

const onError = (e) => {
testLog.done();
if (i === 0) {
errorCountRef.errorCount += 1;
if (i === 0 || errorCountRef.errorCount === errorCountRef.allowedExceptions) {
// If the error happened on the first test run, the test is broken
// and we should not continue running it
// and we should not continue running it. Or if we have reached the
// maximum number of allowed exceptions, we should stop the test run.
throw e;
}
console.error(e);
Expand Down