Skip to content

Commit

Permalink
Add test retry support to reporter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Sep 4, 2020
1 parent 4ca9882 commit 35b64b9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/tests/src.ts/reporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* istanbul ignore file */

'use strict';

// Maximum time in seconds to suppress output
Expand Down Expand Up @@ -108,7 +107,6 @@ export function Reporter(runner: Runner) {
}

log(` Total Tests: ${ suite._countPass }/${ suite._countTotal } passed ${ getDelta(suite._t0) } ${ extra} \n`);
//log();

if (suites.length > 0) {
let currentSuite = suites[suites.length - 1];
Expand All @@ -118,14 +116,22 @@ export function Reporter(runner: Runner) {
currentSuite._countTotal += suite._countTotal;
} else {
clearTimeout(timer);
log(`# status:${ (suite._countPass === suite._countTotal) ? 0: 1 }`);
const status = (suite._countPass === suite._countTotal) ? 0: 1;
log(`# status:${ status }`);

// Force quit after 5s
setTimeout(() => {
process.exit(status);
}, 5000);
}
});

runner.on('test', function(test) {
forceOutput();
const currentSuite = suites[suites.length - 1];
currentSuite._countTotal++;
if (test._currentRetry === 0) {
const currentSuite = suites[suites.length - 1];
currentSuite._countTotal++;
}
});

runner.on('fail', function(test, error) {
Expand Down

0 comments on commit 35b64b9

Please sign in to comment.